搜索elasticsearch的数据条数大于10000的情况解决


默认情况下当用elasticsearch进行深度分页查询时的size-from大于10000的时候,就会报错“”

### kibana里执行
PUT /us_tm_info_v1/_settings
{
  "index.max_result_window": "20000"
}

第二种方式
在config/elasticsearch.yml文件中的最后加上

index.max_result_window: 100000000

这种方法要注意在最前面加上空格

另外,要注意的是官网有关该参数的说明:

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.

也就意味着超过10000条以后的分页,比较耗内存,有可能超过安全值。所以对于超过100000条以后的分页操作,建议可以考虑Scroll深度分页或Search After的操作方式

声明:梨木乔の技术栈|版权所有,违者必究|如未注明,均为原创|本网站采用BY-NC-SA协议进行授权

转载:转载请注明原文链接 - 搜索elasticsearch的数据条数大于10000的情况解决


梨木乔の技术栈