Elasticsearch scroll api gives me this error
{
"error": {
"root_cause": [
{
"type": "parsing_exception",
"reason": "Unknown key for a VALUE_STRING in [scroll].",
"line": 2,
"col": 15
}
],
"type": "parsing_exception",
"reason": "Unknown key for a VALUE_STRING in [scroll].",
"line": 2,
"col": 15
},
"status": 400
}
my code to get documents using scroll api is
GET index/type/_search?scroll=1m
{
"size": 1000,
"query": {
"match_all": {}
}
}
this gives me nice result with "_scroll_id"
{
"_scroll_id": "DnF1ZXJ5VGhlbkZldGNoBQAAAAAAAB1dFmJRbm9UR3h4UUFTVHFzV1dJMHpuOVEAAAAAAAAdXxZiUW5vVEd4eFFBU1Rxc1dXSTB6bjlRAAAAAAAAHV4WYlFub1RHeHhRQVNUcXNXV0kwem45UQAAAAAAAB1gFmJRbm9UR3h4UUFTVHFzV1dJMHpuOVEAAAAAAAAdYhZiUW5vVEd4eFFBU1Rxc1dXSTB6bjlR",
"took": 37,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"failed": 0
},
now according to the documentation I should do like this
GET /_search
{
"scroll": "1m",
"scroll_id": "DnF1ZXJ5VGhlbkZldGNoBQAAAAAAAB1dFmJRbm9UR3h4UUFTVHFzV1dJMHpuOVEAAAAAAAAdXxZiUW5vVEd4eFFBU1Rxc1dXSTB6bjlRAAAAAAAAHV4WYlFub1RHeHhRQVNUcXNXV0kwem45UQAAAAAAAB1gFmJRbm9UR3h4UUFTVHFzV1dJMHpuOVEAAAAAAAAdYhZiUW5vVEd4eFFBU1Rxc1dXSTB6bjlR"
}
and this is giving me above error. Am I using scroll api in a wrong way ? ES version is 5.5.1 and kibana version is 5.5.1. I am using kibana to access ES server.
The problem was that I need to have
GET /_search/scroll
{
"scroll": "1m",
"scroll_id": "DnF1ZXJ5VGhlbkZldGNoBQAAAAAAAB1dFmJRbm9UR3h4UUFTVHFzV1dJMHpuOVEAAAAAAAAdXxZiUW5vVEd4eFFBU1Rxc1dXSTB6bjlRAAAAAAAAHV4WYlFub1RHeHhRQVNUcXNXV0kwem45UQAAAAAAAB1gFmJRbm9UR3h4UUFTVHFzV1dJMHpuOVEAAAAAAAAdYhZiUW5vVEd4eFFBU1Rxc1dXSTB6bjlR"
}
I forgot to add /scroll
after _search
. It works now
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With