Get histogram of documents per hour per term

Hi everybody. Been looking around for a while trying to come up with an answer to this but no luck so far.

My documents are simple. One timestamp and one device_id. Given a start and end date, I would want to get a histogram distribution of the number of requests each device has made in that interval. Something like this:

{ device_id: "first_device", requests: {"less_than_10": 120, "between_10_and_20": 54}}

Any help will be greatly appreciated :slight_smile:

Welcome to our community! :smiley:

If you are looking to do that with the DSL, try a range query - https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-range-query.html

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.