# Elastic Search - "All shards failed" on pagination

https://jaredrhodes.com/blog/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. Use CURL or the Kibana dev console to 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.

Note that large max\_result\_window values increase heap pressure on the cluster since search hits are buffered per shard, so set this no higher than your paging use case requires.
