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

bug记录
最近在学Elasticsearch,查询报错Result window is too large, from + size must be less than or equal to: [10000]
记录下解决方法

错误信息:Result window is too large, from + size must be less than or equal to: [10000]

这是由于默认最大查询数量为10000,而我们代码中设置的查询数量大于这个数了。

因为我需要对es内的数据进行全量去重,所以设置了查询数为100000,所以导致报错。
在这里插入图片描述

解决方案

使用postman或者其他工具发送 PUT请求 :ip:端口/索引名称/_settings

请求体:

{
    
    
  "index":{
    
    
    "max_result_window":1000000
  }
}

在这里插入图片描述
或者 使用kibana,直接运行以下命令

PUT 索引名称/_settings
{
    
    
  "index":{
    
    
    "max_result_window":1000000
  }
}

猜你喜欢

转载自blog.csdn.net/weixin_52799373/article/details/126478893