# Earliest and latest aggregations

**URL:** <https://discuss.elastic.co/t/earliest-and-latest-aggregations/1274>\
**Category:** Kibana\
**Created:** [May 26, 2015, 1:59am UTC](https://discuss.elastic.co/t/earliest-and-latest-aggregations/1274 "2015-05-26T01:59:55Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dcode](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dcode/32/28390_2.png) [@dcode](https://discuss.elastic.co/u/dcode)\
**Post date:** [May 26, 2015, 1:59am UTC](https://discuss.elastic.co/t/earliest-and-latest-aggregations/1274/1 "2015-05-26T01:59:55Z")

</div>

This could be more than just Kibana 4, but that's where I want to do it. I love doing pivot tables to quickly drill through a result set, especially with multiple charts on the same dashboard where I can peer into my datasets. One thing that's really missing is an aggregation on datetime types for min and max. Typically, I call these first heard, last heard, respectively.

For a simple use case, I have logstash forwarding logs of http activity. I'd like to be able to group the activity by maybe user agent and split by host header. I'd like to know the count of this selection, then sub by first heard, then last heard.

I can use this information to detect the earliest time of malware with a specific user agent, for example.

Any ideas? Can this be done with a custom query in Kibana? Feature request for 4.1?

---

<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:** [May 27, 2015, 12:25am UTC](https://discuss.elastic.co/t/earliest-and-latest-aggregations/1274/2 "2015-05-27T00:25:32Z")

</div>

Sounds like a feature request, feel free to raise one! 🙂

---

<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:** [July 6, 2017, 2:19pm UTC](https://discuss.elastic.co/t/earliest-and-latest-aggregations/1274/3 "2017-07-06T14:19:02Z")

</div>


