# If I omit an field from Document can i still search documents where field is not present

**URL:** <https://discuss.elastic.co/t/if-i-omit-an-field-from-document-can-i-still-search-documents-where-field-is-not-present/336037>\
**Category:** Elasticsearch\
**Created:** [June 15, 2023, 5:01am UTC](https://discuss.elastic.co/t/if-i-omit-an-field-from-document-can-i-still-search-documents-where-field-is-not-present/336037 "2023-06-15T05:01:14Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vivek\_Burman](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vivek_burman/32/118310_2.png) [@Vivek\_Burman](https://discuss.elastic.co/u/Vivek_Burman)\
**Post date:** [June 15, 2023, 5:01am UTC](https://discuss.elastic.co/t/if-i-omit-an-field-from-document-can-i-still-search-documents-where-field-is-not-present/336037/1 "2023-06-15T05:01:15Z")

</div>

Hi @Christian_Dahlqvist, so [I re](https://discuss.elastic.co/t/how-can-i-mark-root-object-as-null/327719/8) mentioned omit the field from document.

So my query regarding this is can I perform searches like: Give me the list / aggregate of documents where a field is not present?

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [June 15, 2023, 5:07am UTC](https://discuss.elastic.co/t/if-i-omit-an-field-from-document-can-i-still-search-documents-where-field-is-not-present/336037/2 "2023-06-15T05:07:01Z")

</div>

You can add clauses for where an indexed field, e.g. `custom_field.pid`, is not present, but not for the root level (`custom_field`). You may be able to do this using a script or runtime field, but that may be slow.

---

<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 13, 2023, 5:07am UTC](https://discuss.elastic.co/t/if-i-omit-an-field-from-document-can-i-still-search-documents-where-field-is-not-present/336037/3 "2023-07-13T05:07:23Z")

</div>

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