Elasticsearch-js: { error: 'ElasticsearchIllegalArgumentException[Failed to decode scrollId]; nested: IOException[Bad Base64 input charact er decimal 123 in array position 0]; ', status: 400 }

Created on 23 May 2017  ·  4Comments  ·  Source: elastic/elasticsearch-js

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?

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"

var esClient = new elasticsearch.Client({
  host: esconf.host130,
  apiVersion: "0.90",
  log: 'error'
  });

All 4 comments

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".
2017-05-24_085105
2017-05-24_085304

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);
}

image

@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 :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

aimyth picture aimyth  ·  3Comments

mojzu picture mojzu  ·  4Comments

mfaizanse picture mfaizanse  ·  3Comments

sjparkinson picture sjparkinson  ·  5Comments

rtercias picture rtercias  ·  4Comments