title: Filtering Elasticsearch Results - Nest
body: <p>I currently want to write a query that matches 'name', from a class called entity, then filters out the results where a guid field (stored as a string in ES) is compared to a list of string guids. If the guid stored in the Elasticsearch record matches any in the list of guids then return those results.</p>
  
  <p>The code I have written to do this is:</p>
  
  <pre><code>        ISearchResponse&lt;Entity&gt; oResponse = null;
  
          oResponse = _client.Search&lt;Entity&gt;(s =&gt; s
         .Size(oReq.returnValue)
         .Query(qr =&gt; qr
              .Bool(b =&gt; b
                   .Filter(flt =&gt; flt.Terms(tms =&gt; tms.Field(fd =&gt; fd.extentUid).Terms&lt;string&gt;(oReq.extentUids.ToList())))
                   .Should(sh =&gt; sh
                        .Match(mt =&gt; mt.Field(fl =&gt; fl.name.ToLower()).Query(oReq.name.ToLower())))))
              .Sort(srt =&gt; srt.Descending(SortSpecialField.Score)));
  </code></pre>
  
  <p>The following code returns 0 results when I know for certain that a lot of the Elasticsearch records have a guid that matches one in the list. Can someone help?</p>
  
  <p>Note: In the code I filter the records first but I have tried putting that after the .Should() and I've tried using the .PostFilter().</p>
  
  <p>Thanks in advance,</p>
  
  <p>Gary </p>