# How to search for documents where field doesn't exist?

**URL:** https://discuss.elastic.co/t/how-to-search-for-documents-where-field-doesnt-exist/189112
**Category:** Elasticsearch
**Created:** [July 5, 2019, 1:24pm UTC](https://discuss.elastic.co/t/how-to-search-for-documents-where-field-doesnt-exist/189112 "2019-07-05T13:24:20Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![i333](https://avatars.discourse-cdn.com/v4/letter/i/8491ac/32.png) [@i333](https://discuss.elastic.co/u/i333)
#### Post date: [July 5, 2019, 1:24pm UTC](https://discuss.elastic.co/t/how-to-search-for-documents-where-field-doesnt-exist/189112/1 "2019-07-05T13:24:20Z")

</div>

[https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-exists-query.html#find-docs-null-values](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-exists-query.html#find-docs-null-values) shows how to find a document where the field contains `[]` or null. But how can I search for documents where the field doesn't exist at all on the document?

So if the document contains that field but it is `[]` or null, the search should treat that document as if the field exists (and not include it in the results).

---

<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: [August 2, 2019, 1:24pm UTC](https://discuss.elastic.co/t/how-to-search-for-documents-where-field-doesnt-exist/189112/2 "2019-08-02T13:24:26Z")

</div>

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