# Group by time interval

**URL:** <https://discuss.elastic.co/t/group-by-time-interval/200246>\
**Category:** Elasticsearch\
**Created:** [September 19, 2019, 3:05pm UTC](https://discuss.elastic.co/t/group-by-time-interval/200246 "2019-09-19T15:05:43Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Akhil\_M\_S](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/akhil_m_s/32/46385_2.png) [@Akhil\_M\_S](https://discuss.elastic.co/u/Akhil_M_S)\
**Post date:** [September 19, 2019, 3:05pm UTC](https://discuss.elastic.co/t/group-by-time-interval/200246/1 "2019-09-19T15:05:43Z")

</div>

I have a one hour data in my index.I want to get group the data by its time field ('logged\_time\_unix').here is my query

[aggs] =\> Array  
(  
[viewTimeBy] =\> Array  
(  
[terms] =\> Array  
(  
[field] =\> logged\_time\_unix  
[size] =\> 20000  
)  
)  
)

after this query i got values grouped by time, but there are lot of time values(minute wise points)...I just wanted 5 grouping within 1 hour...how to do that ? anyone help me......

---

<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 17, 2019, 3:05pm UTC](https://discuss.elastic.co/t/group-by-time-interval/200246/2 "2019-10-17T15:05:44Z")

</div>

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