Match exact field empty or not

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

maybe the missing query helps here

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