title: ElasticSearch NEST Checking for null value
body: <p>I have a DateTime? field, I want to return items if that field is in the future or if its NULL.</p>
  
  <p>The NULL check is the problem, ES doesn't store null values, so I can't check it.</p>
  
  <p>Is there not some way of checking for none existence in the .Query?</p>
  
  <p>I know I can .Filter() to get ES to return items that don't have a specific field, but I need to check for NULL in the .Query() which isn't working.</p>
  
  <p>What I have is:</p>
  
  <pre><code>var results = client.Search&lt;ElasticResult&gt;(s =&gt; s
    .Filter(f =&gt; f.Missing(ff=&gt;ff.EndTimeUTC) || f.Exists(ff=&gt;ff.EndTimeUTC))         
    .Query(q =&gt; q
    .Term(p =&gt; p.ShortDescription, "somevalue")
     &amp;&amp; ( q.Range(p =&gt; p.OnField(f =&gt; f.EndTimeUTC).GreaterOrEquals(DateTime.UtcNow)) || 
          q.Term(t =&gt; t.EndTimeUTC, null) )   // THIS IS HAVING NO EFFECT
  ));
  </code></pre>
  
  <p>I'm not sure that the </p>
  
  <pre><code> .Filter(f =&gt; f.Missing("endTimeUTC") || f.Exists("endTimeUTC"))
  </code></pre>
  
  <p>Is actually making any difference, the required documents are being returned by the ShortDescription query, they just don't have a endTimeUTC field</p>