Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Elasticsearch : Unknown key for a VALUE_STRING in [scroll]

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.

like image 557
Saurab Avatar asked Sep 21 '17 05:09

Saurab


1 Answers

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

like image 57
Saurab Avatar answered Nov 18 '22 11:11

Saurab