title: elasticsearch nest 2 add to bool query dynamically
body: <p>I have a boolean query that I want to add dynamically to using the object intializer syntax but I am having trouble doing so. Basically, I have 5 stages of checking parameters, and if they exist they get added to the boolquery. Here's what I am trying to do (obviously doesn't work):</p>
  
  <pre><code>SomeBoolQuery.Must.ToList().Add(someQueryContainer);
  </code></pre>
  
  <p>How can I make the above work so that I can dynamically add queries to the BoolQuery? No, I can't do it via this:</p>
  
  <pre><code>SomeBoolQuery.Must = new QueryContainer[] {query1, query2};
  </code></pre>
  
  <p>Because I don't know how many queries I am going to have and I can't add them all at once. I need a dynamic solution.</p>
  
  <p>I was thinking maybe this:</p>
  
  <pre><code>SomeBoolQueryContainer &amp;= someQuery;
  </code></pre>
  
  <p>and then at the end:</p>
  
  <pre><code>SomeBoolQuery.Must = new QueryContainer[] {someBoolQueryContainer};
  </code></pre>
  
  <p>But that seems a little redundant to say the least. Any ideas?</p>
  
  <p>EDIT: The last option tried above doesn't seem to work. not returning any results.</p>