Nemo

Nemo 关注TA

路漫漫其修远兮,吾将上下而求索。

Nemo

Nemo

关注TA

路漫漫其修远兮,吾将上下而求索。

  •  普罗旺斯
  • 负责帅就完事了
  • 写了1,496,113字

该文章投稿至Nemo社区   Java  板块 复制链接


Elasticsearch:Result window is too large, from + size must be less than or equal to: [10000] but was [20385].

发布于 2020/05/17 23:01 1,477浏览 0回复 772

使用elasticSearch做分页时,提示如下:

org.elasticsearch.search.query.QueryPhaseExecutionException: Result window is too large, from + size must be less than or equal to: [10000] but was [20385]. 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.

字面意思是:查询结果太大,最多只能查询到10000条。

查了下es的文档,确实如此:

index.max_result_window
The maximum value of from + size for searches to this index.
Defaults to 10000. Search requests take heap memory and time proportional to from + size and this limits that memory.
See Scroll or Search After for a more efficient alternative to raising this.

不过这个可以通过修改索引的设置来改动上线:

PUT my_index/_settings
{
"index":{
"max_result_window":1000000
}
}

这里设置为1000000最大,继续操作则没有问题了。



本文标签
 {{tag}}
点了个评