2

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.

1 Answer 1

4

From the official documentation on scrolling:

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

Sign up to request clarification or add additional context in comments.

10 Comments

awwww, I missed that somehow. Thanks. I'm stuck then??? I tried raising the max_result_window on my index but it doesn't seem to change anything... still stuck on 10000
With scrolling you can retrieve all your millions of document (i.e. the hits), but aggregations are a different thing and you cannot "scroll" over them like you'd do with documents. max_result_window is only for documents/hits, not aggregations.
OK, yet the 10000 default limit seems to apply, any idea? maybe there is a different parameter for this?
Oh, indeed, the geohash_grid has a default size of 10000, so you can increase the size as you see fit.
No worries, glad we figured it out!
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.