Mefhisto1
Mefhisto1

Reputation: 2228

Elasticsearch match by either of two fields

Similar to elasticsearch match two fields, I would like to execute a query in ES that uses OR operator

SELECT * FROM [mytype] WHERE title = 'some title' OR title = 'something else'

Upvotes: 2

Views: 60

Answers (1)

Bhavya
Bhavya

Reputation: 16192

You can use bool/should clause

{
  "query":{
    "bool":{
      "should":[
        {
          "match":{
            "title":"some title"
          }
        },
         {
          "match":{
            "title":"something else"
          }
        }
      ]
    }
  }
}

Upvotes: 2

Related Questions