title: elasticsearch bool query combine must with OR
body: <p>I am currently trying to migrate a solr-based application to elasticsearch.</p>
  
  <p>I have this lucene query</p>
  
  <pre><code>(( 
      name:(+foo +bar) 
      OR info:(+foo +bar) 
  )) AND state:(1) AND (has_image:(0) OR has_image:(1)^100)
  </code></pre>
  
  <p>As far as I understand this is a combination of MUST clauses combined with boolean OR: </p>
  
  <p>"Get all documents containing (foo AND bar in name) OR (foo AND bar in info). After that filter results by condition state=1 and boost documents that have an image."</p>
  
  <p>I have been trying to use a bool query with MUST but I am failing to get boolean OR into must clauses. Here is what I have:</p>
  
  <pre><code>GET /test/object/_search
  {
    "from": 0,
    "size": 20,
    "sort": {
      "_score": "desc"
    },
    "query": {
      "bool": {
        "must": [
          {
            "match": {
              "name": "foo"
            }
          },
          {
            "match": {
              "name": "bar"
            }
          }
        ],
        "must_not": [],
        "should": [
          {
            "match": {
              "has_image": {
                "query": 1,
                "boost": 100
              }
            }
          }
        ]
      }
    }
  }
  </code></pre>
  
  <p>As you can see, MUST conditions for "info" are missing.</p>
  
  <p>Does anyone have a solution?</p>
  
  <p>Thank you so much.</p>
  
  <p>** UPDATE **</p>
  
  <p>I have updated my elasticsearch query and got rid of that function score. My base problem still exists.</p>