es官方默认限制索引查询最多只能查询10000条数据,查询第10001条数据开始就会报错:

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

但是很多时候10000数据不能满足项目的需求,所以我们就要解除这个限制。

track_total_hits 参数设置true即可。

查询示例:

http://ip:port/indexName/_search

{
 "track_total_hits":true,
  "query":{
    "match":{
      "name":"value"
    }
  }
}

Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐