Thomas
Thomas

Reputation: 2025

Elasticsearch scroll not working

I am running the following elasticsearch aggregation query

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"}}
                    }
                }
            }
        }'

This returns a scroll_id as expected, but when I use it, the response is "empty", ie

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

It's as if scrolling doesn't work with aggregations.

Any suggestion would be very much appreciated.

Upvotes: 2

Views: 2698

Answers (1)

Val
Val

Reputation: 217554

From the official documentation on scrolling:

If the request specifies aggregations, only the initial search response will contain the aggregations results.

Upvotes: 4

Related Questions