Scroll api error in 5.3

{ [Error: [illegal_argument_exception] Failed to parse request body]
status: 400,
displayName: 'BadRequest',
message: '[illegal_argument_exception] Failed to parse request body',
path: '/_search/scroll',
query: { scroll: '1m' },
body: 'DnF1ZXJ5VGhlbkZldGNoBQAAAAAAAAE5FkZMaEh3cjBDUi1HRlhLSE1LdWstZEEAAAAAAAABOhZGTGhId3IwQ1ItR0ZYS0hNS3VrLWRBAAAAAAAAATsWRkxoSHdyMENSLUdGWEtITUt1ay1kQQAAAAAAAAE8FkZMaEh3cjBDUi1HRlhLSE1LdWstZEEAAAAAAAABPRZGTGhId3IwQ1ItR0ZYS0hNS3VrLWRB',
statusCode: 400,
response: '{"error":{"root_cause":[{"type":"illegal_argument_exception","reason":"Failed to parse request body"}],"type":"illegal_argument_exception","reason":"Failed to parse request body","caused_by":{"type":"json_parse_exception","reason":"Unrecognized token 'DnF1ZXJ5VGhlbkZldGNoBQAAAAAAAAE5FkZMaEh3cjBDUi1HRlhLSE1LdWstZEEAAAAAAAABOhZGTGhId3IwQ1ItR0ZYS0hNS3VrLWRBAAAAAAAAATsWRkxoSHdyMENSLUdGWEtITUt1ay1kQQAAAAAAAAE8FkZMaEh3cjBDUi1HRlhLSE1LdWstZEEAAAAAAAABPRZGTGhId3IwQ1ItR0ZYS0hNS3VrLWRB': was expecting ('true', 'false' or 'null')\n at [Source: org.elasticsearch.transport.netty4.ByteBufStreamInput@3e41afb8; line: 1, column: 457]"}},"status":400}',
toString: [Function],
toJSON: [Function] }

I have implement scroll api in 5.2.2 elasticsearch. It works fine for 5.2.2 and other lower version. But It gives an above error in 5.3. Is there anything i have to change in 5.3?
Here is my sample code.
var data = [];
client.search({
index: source.index,
scroll: '1m',
body: bodyobj
}, function getMoreUntilDone(err, res) {
var cellValues = [];
if (!err) {
res.hits.hits.forEach(function(hit) {
data.push(hit);
});
if (data.length<res.hits.total && data.length < sampleSize) {
// now we can call scroll over and over
client.scroll({
scrollId: res._scroll_id,
scroll: '1m'
}, getMoreUntilDone);
return;
}

I wonder if the client you are using is sending a content-type header for application/json. 5.3 had some changes around Content-Type. You are using an old, now deprecated way of using the scroll API. See the docs for the new way:
https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-scroll.html

Even so, it should have continued to work unless something funny happened around Content-Type. It certainly should work in Content-Type is plain text.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.