# Find missing documents in an index

**URL:** <https://discuss.elastic.co/t/find-missing-documents-in-an-index/23327>\
**Category:** Elasticsearch\
**Created:** [April 20, 2015, 3:05pm UTC](https://discuss.elastic.co/t/find-missing-documents-in-an-index/23327 "2015-04-20T15:05:51Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![seallison](https://avatars.discourse-cdn.com/v4/letter/s/4af34b/32.png) [@seallison](https://discuss.elastic.co/u/seallison)\
**Post date:** [April 20, 2015, 3:05pm UTC](https://discuss.elastic.co/t/find-missing-documents-in-an-index/23327/1 "2015-04-20T15:05:51Z")

</div>

Is there a way for Elasticsearch to tell me documents that are NOT in an  
index given a set of criteria?

I have a field in my documents that contains a unique numerical id. There  
are some ids that are missing from documents in the index and I want to  
find those ids. For example:

{ "product\_id": 1000 }, {"product\_id": 1002}, {"product\_id": 1004},  
{"product\_id": 1005}, ...

In this example I want to find that documents with a product\_id of 1001 and  
1003 are missing from the index. Is this something an aggregation could  
help me identify?

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/50ba365a-02c8-40ce-8d9d-c49cedd7e2da%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/50ba365a-02c8-40ce-8d9d-c49cedd7e2da%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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, 12:18am UTC](https://discuss.elastic.co/t/find-missing-documents-in-an-index/23327/2 "2017-07-06T00:18:40Z")

</div>


