Search with "or" condition


(Denis Peshkov) #1

Hi guys,
can't understood how to do search by few fields, but with or condition:

GET /my_index/my_type/_search
{
"query": {
    "bool": {
        "filter": {
            "bool": {
                "should": {
                    "prefix": [
                        { "field": { "title": "brown" }},
                        { "field": { "message": "dog"   }}
                    ],
                    "minimum_should_match": 1 
                }
            }
        } 
   }
}

(David Pilato) #2

Something like (untested):

GET /my_index/my_type/_search
{
"query": {
    "bool": {
        "filter": {
            "bool": {
                "should": [
                   { "prefix": { "field": { "title": "brown" }}},
                   { "prefix": { "field": { "message": "dog" }}}
                ],
                "minimum_should_match": 1 
           }
      } 
   }
}

(Denis Peshkov) #3

thanks


(system) #4

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