Elasticsearch\Common\Exceptions\BadRequest400Exception: {"error":{"root_cause":[{"type":"illegal_argument_exception","reason":"Result window is too large, from + size must be less than or equal to: [10000] but was [37310]. 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":"elasticsearch_index_green_index","node":"Y5zoS4EGScG2R473vFOtUA","reason":{"type":"illegal_argument_exception","reason":"Result window is too large, from + size must be less than or equal to: [10000] but was [37310]. 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":400} in Elasticsearch\Connections\Connection->process4xxError() (line 630 of /var/www/html/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Connections/Connection.php).

By default max_result_window result is 10000. Sometime search get more than 10000 result. And my application throw above error.

Please suggest a solution for this issue.

Thanks in advance

Comments

hasmimeraj created an issue. See original summary.

hasmimeraj’s picture

Issue summary: View changes
renrhaf’s picture

I encountered the same issue on an e-commerce website with more than 10.000 products.
On the last page, the query asks "from" value 9994 (for example + "size" value 32 then issues an error : "Result window is too large, from + size must be less than or equal to: [10000] but was [10016]."

To be able to fix it, I've simply upgraded the "index.max_result_window" on this particular ElasticSearch index, using a CURL PUT request.
You can use the following command line to change the configuration, if you also need to. Simply replace SERVER and INDEX with your own server and index ones.

curl -XPUT https://SERVER/INDEX/_settings -H 'Content-Type: application/json' -d '{"index.max_result_window": 20000}'

sebastian45’s picture

@Renrhaf solution is correct in my situation too!

Thank you so much!

mparker17’s picture

Status: Active » Fixed

It sounds like this support request has been answered? Feel free to re-open if I have misunderstood.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.