1

I want to get 10001th document from Elastic Search.

How can I overcome the 10k batch limit

http://localhost:9200/_search?size=2&from=9999

Gives this error:

{
  "error" : {
    "root_cause" : [
      {
        "type" : "query_phase_execution_exception",
        "reason" : "Result window is too large, from + size must be less than or equal to: [10000] but was [10001]. See the scroll api for a more efficient way to request large data sets. This limit can be set by changing the [index.max_result_window] index level setting."
      }
    ],
    "type" : "search_phase_execution_exception",
    "reason" : "all shards failed",
    "phase" : "query",
    "grouped" : true,
    "failed_shards" : [
      {
        "shard" : 0,
        "index" : ".kibana",
        "node" : "UWl8qQL8QomaoALoHI3BUw",
        "reason" : {
          "type" : "query_phase_execution_exception",
          "reason" : "Result window is too large, from + size must be less than or equal to: [10000] but was [10001]. See the scroll api for a more efficient way to request large data sets. This limit can be set by changing the [index.max_result_window] index level setting."
        }
      }
    ],
    "caused_by" : {
      "type" : "query_phase_execution_exception",
      "reason" : "Result window is too large, from + size must be less than or equal to: [10000] but was [10001]. See the scroll api for a more efficient way to request large data sets. This limit can be set by changing the [index.max_result_window] index level setting."
    }
  },
  "status" : 500
}
guneysus
  • 6,203
  • 2
  • 45
  • 47
  • 1
    This answer should help: http://stackoverflow.com/questions/35206409/elasticsearch-2-1-result-window-is-too-large-index-max-result-window – Val Jan 13 '17 at 14:22

2 Answers2

0

You have to use Scroll API if you are fetching more then 10k documents.

https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-scroll.html

Nick V
  • 1,591
  • 1
  • 11
  • 7
0

Let us know the is there any Id for your document.If there any Id you can easy search the document based on Id.

Let say like this

GET example/test/_search
{
"query":
{
"match":{
"_id":10001
}
}
}

Hope this might helps