我在使用Elasticsearch进行search查询的过程中,出现了Result window is too large问题。
异常堆栈信息:
Caused by: org.elasticsearch.search.query.QueryPhaseExecutionException:
Result window is too large, from + size must be less than or equal to: [10000] but was [178700].
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.
看这字面意思是
es最大只支持10000的分页参数,我们这里传的是178700,远远超过这个数量。
由于时间紧,我们更改一下索引设置:
curl -XPUT http://127.0.0.1:9200/cmdb-now/_settings -d '{ "index" : { "max_result_window" : 100000000}}'
更改自己的es ip端口还有索引即可。
这种通过修改配置的方式也是治标不治本,随着es的数量越来越多的时候,还会有这个问题,这样需要进行es深度分页优化,后续更新~