Query all but x

Hi,

I am trying to get for an example in logs of sms messages all messages that were not success. The problem is that who ever is not success is not "failed". Therefor How can I look for all the times a value is not success. In other words what is the opposite of:

GET filebeat-*/log/_search
{
  "query": {

        "term" : {"terminationCause": "SUCCESS"}
    }
  }

Found this:

GET filebeat-*/log/_search
{
  "query": {
   "bool":{ 
  
      "must_not": [
        { "match": { "terminationCause": "SUCCESS" } }
      ]
   }
  }
}

in other words

GET filebeat-*/log/_search
{
  "query": {
   "bool":{ 
  
      "must_not": [
        { "match": { "feild": "x" } }
      ]
   }
  }
}

Hi,
one variant of solution is to use boolQuery with must_not occur:

Boolean query | Elasticsearch Guide [8.11] | Elastic

Thanks!

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