# Get histogram of documents per hour per term

**URL:** https://discuss.elastic.co/t/get-histogram-of-documents-per-hour-per-term/250106
**Category:** Elasticsearch
**Created:** [September 27, 2020, 8:57pm UTC](https://discuss.elastic.co/t/get-histogram-of-documents-per-hour-per-term/250106 "2020-09-27T20:57:54Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![pocorschi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pocorschi/32/76289_2.png) [@pocorschi](https://discuss.elastic.co/u/pocorschi)
#### Post date: [September 27, 2020, 8:57pm UTC](https://discuss.elastic.co/t/get-histogram-of-documents-per-hour-per-term/250106/1 "2020-09-27T20:57:54Z")

</div>

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 🙂

---

<div class="post-metadata">

### Author: ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)
#### Post date: [September 28, 2020, 3:28am UTC](https://discuss.elastic.co/t/get-histogram-of-documents-per-hour-per-term/250106/2 "2020-09-28T03:28:40Z")

</div>

Welcome to our community! 😃

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](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-range-query.html)

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [October 26, 2020, 3:28am UTC](https://discuss.elastic.co/t/get-histogram-of-documents-per-hour-per-term/250106/3 "2020-10-26T03:28:43Z")

</div>

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