我正在逐步运行ES查询以获取不同的偏移量和限制。例如100到149,然后150到199,然后200到249 ..依此类推。
当我保持offset + limit大于10,000时,出现以下异常:
{
"error": {
"root_cause": [
{
"type": "query_phase_execution_exception",
"reason": "Result window is too large, from + size must be less than or equal to: [10000] but was [10001]. 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": "xyz",
"node": "123",
"reason": {
"type": "query_phase_execution_exception",
"reason": "Result window is too large, from + size must be less than or equal to: [10000] but was [10001]. 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
}
我知道我们可以通过增加“max_result_window”来解决此问题。我尝试过,它也有帮助。我将其增加到15,000,然后增加到30,000。但是我不允许更改索引级别。
因此,我将其更改回默认值10,000。
我怎么解决这个问题?该查询被API调用击中。
最佳答案
考虑滚动API-https://www.elastic.co/guide/en/elasticsearch/reference/2.2/search-request-scroll.html
manual中也建议这样做
关于elasticsearch - ElasticSearch无法返回超过10,000偏移量的数据,不允许进行索引级别更改。无法使用Scroll API,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58973701/