4

I am trying to iterate over several documents in elasticSearch, and am using Sense (the google chrome plugin to do so). Using scan and scroll for efficiency I get the scroll id as:

POST _search?scroll=10m&search_type=scan
{
  "query": { "match_all": {}}
}

The result of which is:

{
   "_scroll_id": "c2Nhbjs1OzE4ODY6N[...]c5NTU0NTs=",
   "took": 10,
   "timed_out": false,
   "_shards": {
     "total": 5,
     "successful": 5,
     "failed": 0
  },
  "hits": {
     "total": 20000,
     "max_score": 0,
     "hits": []
  }
}

Then pass this to a GET as:

GET _search/scroll?scroll=1m&scroll_id="c2Nhbjs1OzE4ODY6N[...]c5NTU0NTs="

but I get 0 results, specifically:

{
  "_index": "my_index",
  "_type": "_search",
  "_id": "scroll",
  "found": false
}

2 Answers 2

4

I found the problem, I had specified the index my_index in the server box on sense. Removing this and re-executing the post command as:

POST /my_index/_search?scroll=10m&search_type=scan
{
    "query": { "match_all": {}}
}

and passing the resulting scroll_id as:

GET _search/scroll?scroll=1m&scroll_id="c2Nhbjs1OzE4ODY6N[...]c5NTU0NTs="

worked!

Sign up to request clarification or add additional context in comments.

Comments

2

This works in my sense (of course you should replace the id from your case; don't use ")

POST /test/_search?search_type=scan&scroll=1m
GET /_search/scroll?scroll=1m&scroll_id=c2Nhbjs1OzI[...]Tt0b3RhbF9oaXRzOjQ7

1 Comment

Thanks, but I get the same result.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.