Find missing documents in an index

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
To view this discussion on the web visit
For more options, visit