# De-Duplication Query

**URL:** <https://discuss.elastic.co/t/de-duplication-query/221441>\
**Category:** Elasticsearch\
**Created:** [February 28, 2020, 1:47pm UTC](https://discuss.elastic.co/t/de-duplication-query/221441 "2020-02-28T13:47:59Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mrbarret](https://avatars.discourse-cdn.com/v4/letter/m/a9adbd/32.png) [@mrbarret](https://discuss.elastic.co/u/mrbarret)\
**Post date:** [February 28, 2020, 1:47pm UTC](https://discuss.elastic.co/t/de-duplication-query/221441/1 "2020-02-28T13:47:59Z")

</div>

I have a collection of documents where each document looks like  
{  
"\_id": ... ,  
"Author": ...,  
"Content": ....,  
"DateTime": ...  
}

I would like to issue one query to the collection so that I get in response the oldest document from each author. I am considering using a terms aggregation but when I do that I get a list of buckets, being the unique Author values, telling me nothing about which of their documents is the oldest. Furthermore, that approach requires a subsequent call to ES, which is undesirable.

Any advice you could offer would be greatly appreciated. Thanks.

---

<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:** [March 27, 2020, 1:50pm UTC](https://discuss.elastic.co/t/de-duplication-query/221441/2 "2020-03-27T13:50:00Z")

</div>

Closed on March 27, 2020, 1:50pm UTC

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