【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