# Query to retrieve Not existing ids into Index

**URL:** <https://discuss.elastic.co/t/query-to-retrieve-not-existing-ids-into-index/52318>\
**Category:** Elasticsearch\
**Created:** [June 9, 2016, 10:54am UTC](https://discuss.elastic.co/t/query-to-retrieve-not-existing-ids-into-index/52318 "2016-06-09T10:54:55Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![AjmiCh](https://avatars.discourse-cdn.com/v4/letter/a/57b2e6/32.png) [@AjmiCh](https://discuss.elastic.co/u/AjmiCh)\
**Post date:** [June 9, 2016, 10:54am UTC](https://discuss.elastic.co/t/query-to-retrieve-not-existing-ids-into-index/52318/1 "2016-06-09T10:54:55Z")

</div>

Hi,

I want to know the list of ids that does not exist into index . How I can such things ?

Thank you 🙂

---

<div class="post-metadata">

**Author:** ![mikemccand](https://avatars.discourse-cdn.com/v4/letter/m/f04885/32.png) [@mikemccand](https://discuss.elastic.co/u/mikemccand)\
**Post date:** [June 9, 2016, 12:59pm UTC](https://discuss.elastic.co/t/query-to-retrieve-not-existing-ids-into-index/52318/2 "2016-06-09T12:59:58Z")

</div>

I don't think ES can do this: it doesn't know your full universe of IDs?

But you could run a match all query, and use the scroll API to iterate through all results, gather up all the IDs you saw, and subtract that (on the client side) from the full universe of IDs?

Mike McCandless

---

<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 5, 2017, 10:45pm UTC](https://discuss.elastic.co/t/query-to-retrieve-not-existing-ids-into-index/52318/3 "2017-07-05T22:45:02Z")

</div>


