Elasticsearch 回复过期的滚动上下文
Elasticsearch reply for expired scroll context
当使用 Elasticsearch scroll API 接收具有许多匹配项的查询结果时,您必须提供 scroll
超时值。 Elasticsearch 不保证滚动上下文在超时后保持活动状态(滚动被处理为 Elasticsearch 记住的一种 "session")。
但是,如果您在超时到期后"page"向 Elasticsearch 请求另一个,会发生什么情况?你从 Elasticsearch 得到什么回应?它是否具有独特的 HTTP 状态代码?或者 JSON 响应正文中的独特字段?
响应状态代码为 404。您还会收到一条解释所发生情况的错误消息。
{
"error": {
"caused_by": {
"reason": "No search context found for id [35544152]",
"type": "search_context_missing_exception"
},
"failed_shards": [
{
"index": null,
"reason": {
"reason": "No search context found for id [35544152]",
"type": "search_context_missing_exception"
},
"shard": -1
}
],
"grouped": true,
"phase": "query",
"reason": "all shards failed",
"root_cause": [
{
"reason": "No search context found for id [35544152]",
"type": "search_context_missing_exception"
}
],
"type": "search_phase_execution_exception"
},
"status": 404
}
当使用 Elasticsearch scroll API 接收具有许多匹配项的查询结果时,您必须提供 scroll
超时值。 Elasticsearch 不保证滚动上下文在超时后保持活动状态(滚动被处理为 Elasticsearch 记住的一种 "session")。
但是,如果您在超时到期后"page"向 Elasticsearch 请求另一个,会发生什么情况?你从 Elasticsearch 得到什么回应?它是否具有独特的 HTTP 状态代码?或者 JSON 响应正文中的独特字段?
响应状态代码为 404。您还会收到一条解释所发生情况的错误消息。
{
"error": {
"caused_by": {
"reason": "No search context found for id [35544152]",
"type": "search_context_missing_exception"
},
"failed_shards": [
{
"index": null,
"reason": {
"reason": "No search context found for id [35544152]",
"type": "search_context_missing_exception"
},
"shard": -1
}
],
"grouped": true,
"phase": "query",
"reason": "all shards failed",
"root_cause": [
{
"reason": "No search context found for id [35544152]",
"type": "search_context_missing_exception"
}
],
"type": "search_phase_execution_exception"
},
"status": 404
}