Elasticsearch滚动无效

时间:2016-09-29 14:59:41

标签: elasticsearch

我正在运行以下弹性搜索聚合查询

curl -XPOST 'http://localhost:9200/ae2015/_search/?scroll=1m' -d '{
            "size" : 0,
            "query":{"constant_score":{"filter": {"geo_bounding_box" : {"location": {"top_left" : [-180, 85],"bottom_right" : [180, -85]}}}}},
            "aggs":{
                "grid": {
                    "geohash_grid": {"field":"location","precision": 3},
                    "aggs": {
                        "count":{"sum":{"field":"count"}}
                    }
                }
            }
        }'

这会按预期返回一个scroll_id,但是当我使用它时,响应为"为空",即

{"_scroll_id":"xxx","took":936,"timed_out":false,"_shards":{"total":5,"successful":5,"failed":0},"hits":{"total":13238893,"max_score":0.0,"hits":[]}}

好像滚动不适用于聚合。

非常感谢任何建议。

1 个答案:

答案 0 :(得分:3)

来自official documentation on scrolling

  

如果请求指定了聚合,则只有初始搜索响应将包含聚合结果。