title: Dynamic Elastic search query in c# NEST
body: <p>Started working on NEST api for elastic search recently, got stuck on following query, the data.e would be dynamically populated using the input from client in the HttpGet,
  ex: user sends eventA,eventB,eventC then we would add in the should part:</p>
  <pre><code>GET events/_search
  {
    &quot;_source&quot;: false, 
    &quot;query&quot;: {
      &quot;bool&quot;: {
        &quot;must&quot;: [
          {&quot;range&quot;: {
            &quot;timestamp&quot;: {
              &quot;gte&quot;: 1604684158527,
              &quot;lte&quot;: 1604684958731
              }
          }},
          {&quot;nested&quot;: {
            &quot;path&quot;: &quot;data&quot;,
            &quot;query&quot;: {
              &quot;bool&quot;: {
                &quot;should&quot;: [
                  {&quot;match&quot;: {
                     &quot;data.e&quot;: &quot;eventA&quot;
                  }},
                  {&quot;match&quot;: {
                    &quot;data.e&quot;: &quot;eventB&quot;
                  }},
                  {&quot;match&quot;: {
                     &quot;data.e&quot;: &quot;eventC&quot;
                  }},
                ]
              }
              },
            &quot;inner_hits&quot;: {} 
          }}
        ]
      }
    }
  }
  </code></pre>
  <p>Following is what I came up with till now:</p>
  <pre><code>var graphDataSearch = _esClient.Search&lt;Events&gt;(s =&gt; s
                  .Source(src =&gt; src
                      .Includes(i =&gt; i
                          .Field(&quot;timestamp&quot;)
                          )
                   )
                  .Query(q =&gt; q
                      .Bool(b =&gt; b
                          .Must(m =&gt; m
                                  .Range(r =&gt; r
                                      .Field(&quot;timestamp&quot;)
                                      .GreaterThanOrEquals(startTime)
                                      .LessThanOrEquals(stopTime)
                                      ),
                                  m =&gt; m
                                  .Nested(n =&gt; n
                                      .Path(&quot;data&quot;)
                                      .Query(q =&gt; q
                                          .Bool(bo =&gt; bo
                                              .Should(
                                              // what to add here?
                                      )
                                      )
                                  )
                          )
                      )
                  ));
  </code></pre>
  <p>Can someone please help how to build the <code>should</code> part dynamically based on what input the user sends?</p>
  <p>Thanks.</p>