解決方案一
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
}
}