org.elasticsearch.search.query.QueryPhaseExecutionException
当查询结果超过 10000 且当前页含 10000 条之后的数据时,报了如下错误:
Caused by: org.elasticsearch.search.query.QueryPhaseExecutionException: Result window is too large, from + size must be less than or equal to: [10000] but was [100000]. 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.
这篇博客 中讲了如何通过 curl 命令设置 index.number_of_replicas 属性。
windows 上默认没有 curl 命令,不过我发现可以在 Kibana 上通过界面就可以设置。
在 Kibana => Management => Index Management 上点击对应的索引,然后在 Edit settings 标签可以修改索引设置。
下面是将 index.max_result_window 设置为 1000000 。
json
{
"index.blocks.read_only_allow_delete": "false",
"index.priority": "1",
"index.query.default_field": [
"*"
],
"index.write.wait_for_active_shards": "1",
"index.refresh_interval": "1s",
"index.max_result_window": "1000000",
"index.number_of_replicas": "1"
}