amazon-web-services - Elasticsearch 服务AWS:滚动API没有给我预期的响应

标签 amazon-web-services elasticsearch

我正在使用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/

相关文章:

elasticsearch - Elasticsearch中的线性函数评分

mongodb - 从 AWS Glue 连接到 DocumentDB

ruby - 是否可以使用 Ruby AWS SDK stub 文件上传?

amazon-web-services - AWS CloudFormation 堆栈 : add load balancer listener based on condition

amazon-web-services - 自动将亚马逊 AWS 从微型升级到中型

elasticsearch - 如何在heartbeat.yml中添加更多监视器?

node.js - 依次执行node.js代码

elasticsearch - 带脚本的 Elastic NEST SumAggregation

elasticsearch - Logstash:TypeError:没有将nil隐式转换为字符串

indexing - 创建索引时在Analyzer中出现错误