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
Comment #2
hasmimeraj commentedComment #3
renrhafI 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
SERVERandINDEXwith your own server and index ones.curl -XPUT https://SERVER/INDEX/_settings -H 'Content-Type: application/json' -d '{"index.max_result_window": 20000}'Comment #4
sebastian45 commented@Renrhaf solution is correct in my situation too!
Thank you so much!
Comment #5
mparker17It sounds like this support request has been answered? Feel free to re-open if I have misunderstood.