title: ElasticSearch filtered query with operator AND and OR
body: <p>I'm intervening on an existing app which interacts with an elasticsearch sever and i'm seeing some weird responses, probably due to the fact that i'm new to elastic.</p>
  
  <p>I have the indexed item below : </p>
  
  <pre><code>"_id": "59773d268770541557000012",
          "_score": 0.03282923,
          "_source": {
             "_id": "59773d268770541557000012",
             "active": null,
             "address": "dummy address",
             "center_ids": [],
             "consultation_site_ids": [],
             "coordinates": null,
             "created_at": "2017-07-25T14:44:22.270+02:00",
             "death_declaration_form_step_id": "56ddb086f0e0103b44000000",
             "end_of_pregnancy_form_step_id": "56c34e63f0e0105e65000000",
             "fax": "06.95.40.58.84",
             "form_step_ids": [
                "55361b215342491667030000",
                "5541f16252f131f6a125a375",
                "55361ba05342491667040000",
                "553610835342491667010000",
                "55361d225342491667050000",
                "5541f34a52f131f6a125a377"
             ],
             "hospital_id": "57c004905c5393772c002a62",
             "name": "test site d'encronologie",
             "phone": "06.95.40.58.84",
             "short_name": "test site d'encronologie d'endcronologie",
             "sites_union_ids": [],
             "state": "active",
             "updated_at": "2017-07-25T14:44:22.270+02:00",
             "url": "http://www.testurl.com",
             "user_ids": [],
             "warnings_threshold": null,
             "_type": "Site
  </code></pre>
  
  <p>AND I am querying the server with this query: </p>
  
  <pre><code> "query":{  
    "filtered":{  
       "query":{  
          "bool":{  
             "should":[  
                {  
                   "multi_match":{  
                      "fields":[  
                         "name^5",
                         "name.edge^1",
                         "name.full^0.3"
                      ],
                      "query":"enc",
                      "type":"cross_fields"
                   }
                },
                {  
                   "match":{  
                      "name":{  
                         "query":"enc",
                         "type":"phrase_prefix",
                         "operator":"or"
                      }
                   }
                },
                {  
                   "match":{  
                      "name":{  
                         "query":"enc",
                         "type":"boolean",
                         "boost":5
                      }
                   }
                }
             ]
          }
       },
       "filter":{  
          "and":[  
             {  
                "term":{  
                   "hospital_id":"57c004905c5393772c002a62"
                }
             },
             {  
                "term":{  
                   "state":"active"
                }
             }
          ]
       }
    }
  }}
  </code></pre>
  
  <p><strong>Which returns nothing (no hits)</strong></p>
  
  <p>And the other hand, if I change the filter operator "AND" to "OR" I recieve my 1 hit.</p>
  
  <p>I am talking about the "and" on the "filter" branch : </p>
  
  <pre><code>    "filter":{  
              "and":[
  </code></pre>
  
  <p>I realy don't understand how come OR works but not AND? </p>
  
  <p>Then again when I change my query term from "enc" to "zzz_enc" in all the query{} of the first branch <strong>WHILE keeping the "OR"</strong> I have zero matches, even though the filter condition hospital_id and state are true on my item.</p>
  
  <p><strong>Why does the filter operator behave like this ?</strong></p>
  
  <p>Thank you in advance. </p>