1

The following query is run against metricbeat. I am trying to understand what exactly the query is returning.

GET metricbeat-*/_search 
{ 
  "query": { 
    "bool": { 
      "filter": [ 
        { 
          "range": { 
            "@timestamp": { 
              "gte": "now-5m" 
            } 
          } 
        }, 
        { 
          "bool": { 
            "should": [ 
              { 
                "match_phrase": { 
                  "host.name": "noether" 
                } 
              }, 
              { 
                "match_phrase": { 
                  "event.dataset": "system.cpu" 
                } 
              } 
            ] 
          } 
        } 
      ] 
    } 
  } 
}

Is this query equivalent to this?

select * from table where range > now-5m and (host.name = 'noether' OR event.dataset = 'system.cpu')

2

1 Answer 1

2

Yes, your assumption is correct besides that it is actually where range >= now-5m since you use the gte operator in your range filter.

You could avoid using the match_phrase query by alternatively using a match query against the keyword-fields of host.name and event.dataset

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.