WPSolr logo
Search
Close this search box.

Table of contents :

Fix Elasticsearch error “Result window is too large”

wpsolr the7 theme window too big error

Table of contents :

Fix for WPSOLR only

The fix described on this post, involving the index settings,  does not seem to work anymore with recent versions of Elasticsearch.

As a workaround, we added a new option in WPSOLR’s admin screen 2.1 to set the parameter ‘track_total_hits‘ to ‘true’ for all queries.

You can follow the official fix for Result window is too large.

The error

In this post, we are solving the following Elasticsearch error:

"Fatal error: Uncaught Elasticsearch\Common\Exceptions\ServerErrorResponseException: {“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 [11328]. 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”:”xxxxx”,”node”:”xxxxxx”,”reason”:{“type”:”query_phase_execution_exception”,”reason”:”Result window is too large, from + size must be less than or equal to: [10000] but was [11328]. 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} in xxxxxx/public_html/wp-content/plugins/wpsolr-pro/wpsol in /home/185405.cloudwaysapps.com/eyuznfmqse/public_html/wp-content/plugins/wpsolr-pro/wpsolr/core/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Connections/Connection.php on line 660"

 

The explanation

The error simply means that you tried to show results located after the 10,000th position.

For instance, our WooCommerce The7 demo with 100 thousand products displayed the error after clicking on the last page of results (page 6682, or 100,000th position):

Image wpsolr-the7-theme-window-too-big-error.png of Fix Elasticsearch error

 

Why 10,000?

10,000 is a hard-coded limit in Elasticsearch. This is a default setting, and you’ll need to change it if you want to overcome the problem.

 

The solution

  • Connect to your Elasticsearch server

The demo being on Cloudways, you can ssh to your server as shown below, directly inside your browser. Else, you can ssh by your own means, or even update your settings in Kibana.

Image wpsolr-cloudways-open-ssh-session-in-browser.png of Fix Elasticsearch error

 

  • Find your index name

The settings are related to your index. You need to find your index name, which is stored in WPSOLR.

Image wpsolr-the7-theme-window-too-big-error-index-name.png of Fix Elasticsearch error

 

  • cURL command to change the index settings

curl -X PUT “https://localhost:9200/YOUR_INDEX_NAME_HERE/_settings” -H ‘Content-Type: application/json’ -d ‘{ “index” : { “max_result_window” : YOUR_MAX_RESULTS_HERE } }’

Image wpsolr-the7-theme-window-too-big-error-curl.png of Fix Elasticsearch error

That’s it, nothing to do more, not even restarting Elasticsearch.

The fixed results

Below is the demo with the new settings, able to display the 100,000th results. Nice, is it?

Image wpsolr-the7-theme-window-too-big-error-fixed.png of Fix Elasticsearch error

Related posts ... not powered by WPSOLR 😊

The benefits of Elasticsearch security

Introduction Elasticsearch is a powerful and flexible search and analytics engine that is widely used for storing, searching, and analyzing data. However, using Elasticsearch without