# Search set of intervals

**URL:** <https://discuss.elastic.co/t/search-set-of-intervals/202734>\
**Category:** Elasticsearch\
**Created:** [October 8, 2019, 9:29pm UTC](https://discuss.elastic.co/t/search-set-of-intervals/202734 "2019-10-08T21:29:08Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![poorvig89](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/poorvig89/32/28505_2.png) [@poorvig89](https://discuss.elastic.co/u/poorvig89)\
**Post date:** [October 8, 2019, 9:29pm UTC](https://discuss.elastic.co/t/search-set-of-intervals/202734/1 "2019-10-08T21:29:08Z")

</div>

Given a set of time intervals in indexed data. is there a way where we can identify if a given time lies in any of the intervals present.  
For eg:  
If the indexed data has  
{  
"time\_shifts": [  
[11:30:00, 14:30:00]  
[15:00:00, 16:30:00]  
[18:30:00, 22:30:00]  
]  
}

and if we want to see if 12:00:00 is there then it should return the above document  
and if we search for 17:00:00, it should not return anything as it does not lie in any of the intervals

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [October 9, 2019, 7:02am UTC](https://discuss.elastic.co/t/search-set-of-intervals/202734/2 "2019-10-09T07:02:13Z")

</div>

Hey,

take a look at the [range datatypes](https://www.elastic.co/guide/en/elasticsearch/reference/7.4/range.html)

--Alex

---

<div class="post-metadata">

**Author:** ![poorvig89](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/poorvig89/32/28505_2.png) [@poorvig89](https://discuss.elastic.co/u/poorvig89)\
**Post date:** [October 9, 2019, 5:08pm UTC](https://discuss.elastic.co/t/search-set-of-intervals/202734/3 "2019-10-09T17:08:16Z")

</div>

Thank you so much Alex

---

<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:** [November 6, 2019, 5:08pm UTC](https://discuss.elastic.co/t/search-set-of-intervals/202734/4 "2019-11-06T17:08:27Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
