我正在使用scroll api使用scroll_id获取搜索结果,我的请求是:
https://my-es-domain-5euba7647rpc35m5utkiwweds.eu-west-1.es.amazonaws.com/_search/scroll?scroll_id=123
奇怪的是,作为回应,我得到了这个:
{
"took": 1,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"skipped": 0,
"failed": 0
},
"hits": {
"total": 3,
"max_score": 1,
"hits": []
}
}
我在这里想念什么吗?为什么我没有得到其余的搜索结果?
如您所见,hits属性为空。
编辑:只是要注意,当我尝试使用滚动API获取所有结果时,一切正常:
https://my-es-domain-5euba7647rpc35m5utkiwweds.eu-west-1.es.amazonaws.com/_search?scroll=5m&size=3
{
"_scroll_id": "123",
"took": 4,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"skipped": 0,
"failed": 0
},
"hits": {
"total": 3,
"max_score": 1,
"hits": [
{
"_index": "movies",
"_type": "movie",
"_id": "2",
"_score": 1,
"_source": {
"title": "Lawrence of Arabia",
"director": "David Lean",
"year": 1962,
"genres": [
"Adventure",
"Biography",
"Drama"
]
}
},
{
"_index": "movies",
"_type": "movie",
"_id": "1",
"_score": 1,
"_source": {
"title": "The Assassination of Jesse James by the Coward Robert Ford",
"director": "Andrew Dominik",
"year": 2007,
"genres": [
"Biography",
"Crime",
"Drama"
]
}
},
{
"_index": "movies",
"_type": "movie",
"_id": "3",
"_score": 1,
"_source": {
"title": "To Kill a Mockingbird",
"director": "Robert Mulligan",
"year": 1962,
"genres": [
"Crime",
"Drama",
"Mystery"
]
}
}
]
}
}
EDIT2:我的错误。当我第一次请求时,我已经获得了所有三个结果,然后当我将scroll_id作为参数传递并尝试获取其余搜索结果时,hits数组为空:)
最佳答案
也许您只有3个与此搜索匹配的文档?
第一卷返回它们,第二卷没有更多文档可检索
关于amazon-web-services - Elasticsearch 服务AWS:滚动API没有给我预期的响应,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54277997/