title: How to use and , or operator(&&, ||) in elasticsearch c#
body: <p>I am trying to search records in Nest, my conditions are, <code>expiration_date</code> can be null or it can be within some date(ex. 10-20-2018) and <code>effective_date</code> can be some date (09-20-2018). </p>
  
  <p>Below is my query, here I am not able to use || and &amp;&amp; operator, either syntax issue, or my approach is wrong, can anyone help me with this?</p>
  
  <pre><code>docs = await _client.SearchAsync&lt;PriceList&gt;(s =&gt; s.Index(config.elasticsearchIndex)
  
                  .Query(a =&gt; a.Bool(c=&gt;c.Should(
  
                      d =&gt; d.Bool(e =&gt; e.MustNot(f=&gt;f.Exists(g =&gt; g.Field(h =&gt; h.ExpirationDate))))
                      ||
                       .Query(a =&gt; a.DateRange(r =&gt; r.Field(field =&gt; field.ExpirationDate).GreaterThanOrEquals(forThisRange.fromDate)))
                      )))
  
                  .Query(a =&gt; a.DateRange(r =&gt; r.Field(field =&gt; field.EffectiveDate).LessThanOrEquals(forThisRange.toDate)))
  </code></pre>
  
  <p>My nest version is 6.4</p>
  
  <p>UPDATED Query:</p>
  
  <p>.Query(a => a.Bool(c=>c.Should(</p>
  
  <pre><code>                d =&gt; d.Bool(e =&gt; e.MustNot(f=&gt;f.Exists(g =&gt; g.Field(h =&gt; h.ExpirationDate))))
                  ,
                  d=&gt;d.Bool(e=&gt;e.Must(f=&gt;f.DateRange(r =&gt; r.Field(field =&gt; field.ExpirationDate).GreaterThanOrEquals(forThisRange.fromDate))))
                  //i=&gt;i.DateRange
  
                  )))
  
              .Query(a =&gt; a.DateRange(r =&gt; r.Field(field =&gt; field.EffectiveDate).LessThanOrEquals(forThisRange.toDate)))
  </code></pre>
  
  <p>I am not getting any error, but not getting extra record,it is giving correct result + "expiration_date" has less than 10-20-2018,the later should not.</p>