title: Elasticsearch date range intersection
body: <p>I'm storing something like the following information in elastic search:</p>
  
  <pre><code>{ "timeslot_start_at" : "2013-02-01", "timeslot_end_at" : "2013-02-03" }
  </code></pre>
  
  <p>Given that I have another date range (given from user input for example) I am wanting to search for an intersecting time range. Similar to this: <a href="https://stackoverflow.com/questions/325933/determine-whether-two-date-ranges-overlap">Determine Whether Two Date Ranges Overlap</a> Which outlines that the following logic is what i'm after:</p>
  
  <pre><code>(StartDate1 &lt;= EndDate2) and (StartDate2 &lt;= EndDate1)
  </code></pre>
  
  <p>But I'm unsure of how to fit this into an elastic search query, would I use a range filter and only set the 'to' values, leaving the from blank? Or is there a more efficient way of doing this?</p>