title: ElasticSearch Nest Query with Dynamic Match
body: <p>I want to build an ElasticSearch Nest SearchDescriptor dynamically using conditional Match. The UI has two check boxes "Exclude Email" and "Exclude Loose Files". If both are checked, the search result will match 0 hits.</p>
  
  <p>These 4 queries work, but I can't figure out how to make the Match parts dynamic based on conditions (other than just having 'if-elseif-else' statements for each permutation of UI check-boxes). </p>
  
  <p>Thank you for any suggestions you have.</p>
  
  <pre><code>                var searchDescriptor = new SearchDescriptor&lt;MyDocument&gt;()
                          .Query(q =&gt; q
                              .Match(m =&gt; m.OnField(p =&gt; p.isemail).Query("true"))
                              &amp;&amp; q.Match(m =&gt; m.OnField(p =&gt; p.isemail).Query("false"))
                              &amp;&amp; q.QueryString(p =&gt; p.Query(searchParameters.query).DefaultOperator(Operator.And))
                              &amp;&amp; q.Term(p =&gt; p.Author, searchParameters.author == null ? null : searchParameters.author.ToLower())
                          );
  
                  var searchDescriptor = new SearchDescriptor&lt;MyDocument&gt;()
                          .Query(q =&gt; q
                              .Match(m =&gt; m.OnField(p =&gt; p.isemail).Query("true"))
                              &amp;&amp; q.QueryString(p =&gt; p.Query(searchParameters.query).DefaultOperator(Operator.And))
                              &amp;&amp; q.Term(p =&gt; p.Author, searchParameters.author == null ? null : searchParameters.author.ToLower())
                          );
  
                  var searchDescriptor = new SearchDescriptor&lt;MyDocument&gt;()
                          .Query(q =&gt; q
                              .Match(m =&gt; m.OnField(p =&gt; p.isemail).Query("false"))
                              &amp;&amp; q.QueryString(p =&gt; p.Query(searchParameters.query).DefaultOperator(Operator.And))
                              &amp;&amp; q.Term(p =&gt; p.Author, searchParameters.author == null ? null : searchParameters.author.ToLower())
                          );
  
                  var searchDescriptor = new SearchDescriptor&lt;MyDocument&gt;()
                          .Query(q =&gt; q
                              .QueryString(p =&gt; p.Query(searchParameters.query).DefaultOperator(Operator.And))
                              &amp;&amp; q.Term(p =&gt; p.Author, searchParameters.author == null ? null : searchParameters.author.ToLower())
                          );
  </code></pre>