Elastic Search – “All shards failed” on pagination

If you are trying to page past the first 10000 documents in an Elasticsearch index and have not set the max_result_window setting for that index then you may receive one of the two following errors:

  • All shards failed
  • Result window is too large, from + size must be less than or equal to: [10000] but was [*].

To resolve this the max_result_window setting must be set for the index that is being paged through. Using CURL or the Kibana dev console and make a PUT request to update the setting.

PUT {MY_INDEX}/_settings" 
{ 
   "index" : { "max_result_window" : {MAX_VALUE}} 
}

Replacing MY_INDEX with the index you wish to update the settings to and replacing MAX_VALUE with the maximum value for the result window. For the current project it was set to 50,000,000.