一、说明
ES 默认返回数据量为 10000 条, 当分页的 from 超过 10000 条的时候,es 就会如下报错:
Result window is too large, from + size must be less than or equal to:[10000] but was [10500]. See the scroll api for a more efficient way to requestlarge data sets. This limit can be set by changing the[index.max_result_window] index level parameter
二、解决方案
通过设置 index 参数 max_result_window 的值
PUT /index_name/_settings
{
"index": {
"max_result_window": "100000"
}
}
index_name 是你的索引名