Sorry, my English is not good. here's my code:
esdao.searchScollFor130 = function() {
esClient.search({
index: esconf.index130,
type: esconf.ttype,
scroll: '30s',
search_type: 'scan',
body: {query: {match_all: {}}}
}, function getMoreUntilDone(err, ress) {
console.log(ress);
if (ress.hits.total !== allresult.length) {
esClient.scroll({
scrollId: ress._scroll_id,
scroll: '30s'
}, getMoreUntilDone);
} else {
console.log('every "test" title', allTitles);
}
});
console.log(allresult);
}
but
Please answer me why this is?
Can you make sure that you have the latest version?
npm install --save elasticsearch@latest
yes,I have already installed it。
I think it may not be the JS problem, because the same mistake also appears in th "_plugin/head".


but,I know the cause of the problem。
Change scroll_id, Remove “”。
scroll_id="cXVlcnlUaGVuRmV0Y2g7MjsxNjY1MjppZExGcjRFX1RrQzNBTnVybC10V2N3OzE2NjUzOmlkTEZyNEVfVGtDM0FOdXJsLXRXY3c7MDs="
==>
scroll_id=cXVlcnlUaGVuRmV0Y2g7MjsxNjY1MjppZExGcjRFX1RrQzNBTnVybC10V2N3OzE2NjUzOmlkTEZyNEVfVGtDM0FOdXJsLXRXY3c7MDs=
but in nodejs ,Double quotes will be added automatically。
var allresult= [];
esdao.searchScollFor130 = function() {
esClient.search({
index: esconf.index130,
type: esconf.ttype,
scroll: '30s',
search_type: 'scan',
body: {query: {match_all: {}}}
}, function getMoreUntilDone(error, response) {
console.log("================================");
console.log(response);
console.log(error);
console.log("================================");
response.hits.hits.forEach(function(hit) {
var jsonobject = {};
jsonobject.docTitle = hit.fields.docTitle;
jsonobject.issn = hit.fields.issn;
allresult.push(jsonobject);
});
if (response.hits.total !== allresult.length) {
esClient.scroll({
scrollId: response._scroll_id,
scroll: '30s'
}, getMoreUntilDone);
} else {
console.log('every "test" title', allresult);
}
});
console.log(allresult);
}

@spalger haha~
I have solved the problem。 Inspired by #546。
Because my server version is 1.2.1,When creating a client,add apiVersion: "0.90"
var esClient = new elasticsearch.Client({
host: esconf.host130,
apiVersion: "0.90",
log: 'error'
});
Glad you figured that out :)
Most helpful comment
@spalger haha~
I have solved the problem。 Inspired by #546。
Because my server version is 1.2.1,When creating a client,add apiVersion: "0.90"