Value does not exist

I am familiar with checking if a field exists using the exists query. I am wondering if there is a way to check if a value does not exist instead; something like this:

GET /_search
{
  "query": {
    "bool": {
      "must_not": {
        "exists": {
          "field": "user",
           "value": "id"
        }
      }
    }
  }
}

Welcome to our community! :smiley:

Do you mean you want to return documents that don't have that value?

Thanks @warkolm
I think another way to explain it is I want to see if the occurrence of the value is 0. I know one way to do this is to use a count query. But it is a compound query and that won't work.

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