版权声明:本文为博主原创文章,未经博主允许请随意转载。 https://blog.csdn.net/qq_25925973/article/details/85303814
在ES中查询结果超过10000条的时候,会报出如下错误:
{
"error": {
"root_cause": [
{
"type": "query_phase_execution_exception",
"reason": "Result window is too large, from + size must be less than or equal to: [1000000] but was [10000010]. See the scroll api for a more efficient way to request large data sets. This limit can be set by changing the [index.max_result_window] index level parameter."
}
],
"type": "search_phase_execution_exception",
"reason": "all shards failed",
"phase": "query",
"grouped": true,
"failed_shards": [
{
"shard": 0,
"index": "results",
"node": "JwHV4B5VSN-F9US2cNmXZA",
"reason": {
"type": "query_phase_execution_exception",
"reason": "Result window is too large, from + size must be less than or equal to: [1000000] but was [10000010]. See the scroll api for a more efficient way to request large data sets. This limit can be set by changing the [index.max_result_window] index level parameter."
}
}
]
},
"status": 500
}
默认只能查到一万条,将该设置增大即可。
解决方法:
curl -XPUT http://127.0.0.1:9200/results/_settings -d '{ "index" : { "max_result_window" : 1000000}}'
注意:上面url中的results换成自己的index名称
或者在postman中发送put请求也可以。报文如下:
{ "index" : { "max_result_window" : 1000000}}