OR query in ElasticSearch 2.0

(Jean Yves Goubet) #1

I don't understand what happened to the OR filter in 2.0, I understand that AND filters can be replaced with multiple filter clauses in a bool query but I don't get how to manage it with the OR condition.
Any ideas ?

(Ivan Brusic) #2

AND clauses are basically MUSTs in a boolean query and OR clauses translate


(Jean Yves Goubet) #3

Thanks Ivan but that's partially true as MUST and SHOULD clauses have incidence on scoring and filter not :confused:

(Zachary Tong) #4

To do a filtered OR, you can add a bool inside the filter (of another bool) which contains all your OR'd clauses

    "query": {
        "bool": {
            "filter": {
                "bool": {
                    "should": [

(Jean Yves Goubet) #5

That's why :slight_smile:
Thanks a lot Zachary

(system) #6