# Filter search results with same ID using different indices

**URL:** <https://discuss.elastic.co/t/filter-search-results-with-same-id-using-different-indices/248316>\
**Category:** Elasticsearch\
**Created:** [September 11, 2020, 12:18pm UTC](https://discuss.elastic.co/t/filter-search-results-with-same-id-using-different-indices/248316 "2020-09-11T12:18:01Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![tim\_cgn](https://avatars.discourse-cdn.com/v4/letter/t/a4c791/32.png) [@tim\_cgn](https://discuss.elastic.co/u/tim_cgn)\
**Post date:** [September 11, 2020, 12:18pm UTC](https://discuss.elastic.co/t/filter-search-results-with-same-id-using-different-indices/248316/1 "2020-09-11T12:18:01Z")

</div>

Hello together,

i have a simple query that performs a search on an alias. This alias contains several indices.  
Documents are stored in the different indexes with the same id, but have a different status, so they differ in content.

Now when I do a search I want to search all indexes but return the document from the most recent index.

Is it possible to remove documents with the same id, and can this be decided on the index?

Greetings,  
Tim

---

<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 9, 2020, 12:18pm UTC](https://discuss.elastic.co/t/filter-search-results-with-same-id-using-different-indices/248316/2 "2020-10-09T12:18:15Z")

</div>

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