title: Elasticsearch complex filter
body: <p>I use elasticsearch search to retrieve some doc and I would like to do a simple statement like:</p>
  
  <pre><code>if ((a == "1" || b == "2") || (c == "3" &amp;&amp; d == "4"))
  </code></pre>
  
  <p>I use the first statement ((a == "1" || b == "2")) with that </p>
  
  <pre><code>$filter ['bool'] ['must'] [] = array (
    'bool' =&gt; array (
      'should' =&gt; array (
        array (
          'terms' =&gt; array (
            'a' =&gt; $aName
          ) 
        ),
        array (
          'terms' =&gt; array (
            'b' =&gt; $bName
          ) 
        ),
      ),           
    ) 
  );
  </code></pre>
  
  <p>But after I'm lost. I don't know how I can add:</p>
  
  <pre><code>(c == "3" &amp;&amp; d == "4")
  </code></pre>