I am running the following query against the count end point trying to get a count of all of the documents where the hq field is either missing or empty and I am getting a count of zero back even though I know there are lots of records where there is no value for hq:
{
"query": {
"bool": {
"must_not": {
"exists": {
"field": hq
}
}
}
}
}
In my index it appears that the hq field is present whether or not the field is actually populated and I see stuff like this :
......,
"hq": "",
......., etc
I thought that the must_not exists type of query would find documents where the field was outright missing OR empty, is that not the case? How can I get this query to work correctly? Do I need to reindex and treat the hq field differently? Right now it is just a string. Any help would be appreciated. Thanks.
Kevin