# Match exact field empty or not

**URL:** <https://discuss.elastic.co/t/match-exact-field-empty-or-not/91062>\
**Category:** Elasticsearch\
**Created:** [June 28, 2017, 8:15am UTC](https://discuss.elastic.co/t/match-exact-field-empty-or-not/91062 "2017-06-28T08:15:06Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rgn](https://avatars.discourse-cdn.com/v4/letter/r/54ee81/32.png) [@Rgn](https://discuss.elastic.co/u/Rgn)\
**Post date:** [June 28, 2017, 8:15am UTC](https://discuss.elastic.co/t/match-exact-field-empty-or-not/91062/1 "2017-06-28T08:15:06Z")

</div>

Hi

i'm trying to find request can match exact field with a empty value or not but without succes.  
inside a script i call:

> GET index-\*/type/\_search  
> {  
> "query": {  
> "bool": {  
> "must": [  
> {"match\_phrase": {"field1": "value1"}},  
> {"match\_phrase": {"field2": "value2"}},  
> {"match\_phrase": {"field3": "value3"}},  
> {"match\_phrase": {"field4": "value4"}},  
> {"match\_phrase": {"field5": "value5"}}  
> ]  
> }  
> }  
> }

I get the result i want , but sometime my field5 have to be empty and :

> GET index-\*/type/\_search  
> {  
> "query": {  
> "bool": {  
> "must": [  
> {"match\_phrase": {"field1": "value1"}},  
> {"match\_phrase": {"field2": "value2"}},  
> {"match\_phrase": {"field3": "value3"}},  
> {"match\_phrase": {"field4": "value4"}},  
> {"match\_phrase": {"field5": ""}}  
> ]  
> }  
> }  
> }

Dont send me back anything ,i have to put out ` {"match_phrase": {"field5": ""}}`for get answer

How can i do for have generic request, can match exact value for field empty or not

thanx

---

<div class="post-metadata">

**Author:** ![s1monw](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/s1monw/32/3637_2.png) [@s1monw](https://discuss.elastic.co/u/s1monw)\
**Post date:** [June 30, 2017, 7:51am UTC](https://discuss.elastic.co/t/match-exact-field-empty-or-not/91062/2 "2017-06-30T07:51:33Z")

</div>

maybe the `missing` [query](https://www.elastic.co/guide/en/elasticsearch/guide/current/_dealing_with_null_values.html#_missing_query) helps here

---

<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 28, 2017, 7:51am UTC](https://discuss.elastic.co/t/match-exact-field-empty-or-not/91062/3 "2017-07-28T07:51:33Z")

</div>

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