【Elasticsearch】解除默认查询10000条的限制


解决方案一

elasticsearch默认输出最多一万条
查询第10001条数据开始就会报错:Result window is too large, from + size must be less than or equal to
但是很多时候10000数据不能满足项目的需求,所以我们就要解除这个限制。
ip:port为es的ip和端口
curl -H "Content-Type: application/json" -XPUT http://ip:port/_settings -d '{ "index" : { "max_result_window" : 100000000}}'

如果java调用es client还需要加

searchSourceBuilder.trackTotalHits(true);

 解决方案二

创建索引时设置

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


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM