# Query available documents

**URL:** <https://discuss.elastic.co/t/query-available-documents/62729>\
**Category:** Elasticsearch\
**Created:** [October 11, 2016, 3:35pm UTC](https://discuss.elastic.co/t/query-available-documents/62729 "2016-10-11T15:35:49Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![japel](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/japel/32/9241_2.png) [@japel](https://discuss.elastic.co/u/japel)\
**Post date:** [October 11, 2016, 3:35pm UTC](https://discuss.elastic.co/t/query-available-documents/62729/1 "2016-10-11T15:35:49Z")

</div>

Hello there,

I would like to perform a search that complies to these rules:

 ![](https://us1.discourse-cdn.com/elastic/original/2X/4/4c4c9434bb2ec00a324646836c1a8a3cbedc8739.png)

Imagine

- the horizontal line is date/time
- the red rectangles are indexed unavailable date ranges in form of:  
[  
{  
"from": "2016-11-10T00:00:00+00:00"  
"to": "2016-11-15T00:00:00+00:00"  
},  
{  
"from": "2016-11-03T00:00:00+00:00"  
"to": "2016-11-06T00:00:00+00:00"  
},  
...  
]
- the brackets represent the kind of searches I want to perform (providing startDate and endDate) and if or not to return results

How could I achieve something like this?

Grateful for any help!

Best regards

japel

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 5, 2017, 10:12pm UTC](https://discuss.elastic.co/t/query-available-documents/62729/2 "2017-07-05T22:12:38Z")

</div>


