title: How combine query, must and must_not in elasticsearch?
body: <p>The following documents should be found:</p>
  
  <pre><code>matches query 'my text' AND (has not field OR field with value)
  </code></pre>
  
  <p>I have tried the following:</p>
  
  <pre><code>GET /myIndex/_search
  
  {
    "query": {
      "bool": {
        "must": [
          {
            "query_string": {
              "query": "my text"
            }
          },
          {
          }
        ],
        "filter": {
          "bool": {
            "must_not": {
              "exists": {
                "field": "myField"
              }
            },
            "must": {
              "terms": {
                "myField": [
                  "myValue"
                ]
              }
            }
          }
        }
      }
    }
  }
  </code></pre>
  
  <p>It should (but does <strong>not</strong>) work liek that:</p>
  
  <ol>
  <li>bool combine via OR <code>must</code> and <code>filter</code> parts</li>
  <li>first <code>must</code> select by query</li>
  <li>filter uses bool which combines by OR <code>must and</code>must_not`</li>
  </ol>
  
  <p>But this behaves like <code>must</code> combined with <code>must_not</code> via <em>AND</em> clause. E.g. when I removed "must" or "must_not" query works.</p>
  
  <p>How change query to combine "must" with "must_not" via <strong>OR</strong> clause?</p>
  
  <p>Elasticsearch version is <code>5.3.2</code></p>