# Lucene query string to match missing fields

**URL:** <https://discuss.elastic.co/t/lucene-query-string-to-match-missing-fields/180993>\
**Category:** Elasticsearch\
**Created:** [May 14, 2019, 11:57am UTC](https://discuss.elastic.co/t/lucene-query-string-to-match-missing-fields/180993 "2019-05-14T11:57:33Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![michele\_crudele](https://avatars.discourse-cdn.com/v4/letter/m/91b2a8/32.png) [@michele\_crudele](https://discuss.elastic.co/u/michele_crudele)\
**Post date:** [May 14, 2019, 11:57am UTC](https://discuss.elastic.co/t/lucene-query-string-to-match-missing-fields/180993/1 "2019-05-14T11:57:33Z")

</div>

I'm in the need to write a Lucene query string (I cannot use ES DSL unfortunately) to match all documents where a given field is missing: e.g. something like `_missing_:mydoc.field`. I tried the `_exists_` special field, but the query `_exists_:mydoc.field` matches documents where `mydoc.field` is assigned an empty array. I need only those where the `mydoc.field` is not set at all.

---

<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:** [June 11, 2019, 11:57am UTC](https://discuss.elastic.co/t/lucene-query-string-to-match-missing-fields/180993/2 "2019-06-11T11:57:36Z")

</div>

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