ledneb
ledneb

Reputation: 1431

How do I write an OR query in Kibana (ElasticSearch)?

Using ElasicSearch's JSON Query DSL through Kibana, how do I retrieve all documents which have:

Upvotes: 0

Views: 92

Answers (2)

Pierre Mallet
Pierre Mallet

Reputation: 7221

You have to use a Bool query for that :

... If the bool query is a filter context or has neither must or filter then at least one of the should queries must match a document for it to match the bool query

    POST <your_index>/_search 
    {
      "query": {
        "bool": {
          "should": [

              { "match_phrase" : { "messageTemplate" : "My message" } },
              { "term" : { "level" : "Error" } }

          ]
        }
      }
    }

Upvotes: 2

Patrick Hoge
Patrick Hoge

Reputation: 66

Alternatively, you could type in the Kibana search bar:

messageTemplate:"My message" || level:"Error"

or

messageTemplate:"My message" OR level:"Error"

Upvotes: 1

Related Questions