# Get oldest / newest document in \*beat

**URL:** <https://discuss.elastic.co/t/get-oldest-newest-document-in-beat/212229>\
**Category:** Elasticsearch\
**Created:** [December 17, 2019, 9:14pm UTC](https://discuss.elastic.co/t/get-oldest-newest-document-in-beat/212229 "2019-12-17T21:14:27Z")\
**Posts on this page:** 1\
**Showing post:** 8

<div class="post-metadata">

**Author:** ![EricJohnson](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ericjohnson/32/53592_2.png) [@EricJohnson](https://discuss.elastic.co/u/EricJohnson)\
**Post date:** [December 20, 2019, 8:57pm UTC](https://discuss.elastic.co/t/get-oldest-newest-document-in-beat/212229/8 "2019-12-20T20:57:00Z")

</div>

In order to get around this problem I am changing my approach. Of course it created a new issue... But here's the follow up question:

> [@Aggregate metricbeat 'host' info by ID & Unique host configuration?](https://discuss.elastic.co/t/aggregate-metricbeat-host-info-by-id-unique-host-configuration/212709):
>
> Hi there. I'm trying to aggregate host configuration data out of metricbeat. I need to look at the documents for a single day, bucketing by ID, and return the host info. What I'm trying to do is watch for configuration changes on a daily basis. If I use this code: "query": { 'bool': { 'must': [{"exists": {"field": "host"}}, {'term': {'@timestamp': date}}] } }, "aggs": { "by\_id": { "terms": {"field": "fields.id"} } } I get an array out containing our fields.id …

Thank you!

---

_[View the full topic](https://discuss.elastic.co/t/get-oldest-newest-document-in-beat/212229)._
