# Querying Date Range Data Type

**URL:** <https://discuss.elastic.co/t/querying-date-range-data-type/202394>\
**Category:** Elasticsearch\
**Created:** [October 4, 2019, 9:38pm UTC](https://discuss.elastic.co/t/querying-date-range-data-type/202394 "2019-10-04T21:38:57Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ajohnson10209](https://avatars.discourse-cdn.com/v4/letter/a/a587f6/32.png) [@ajohnson10209](https://discuss.elastic.co/u/ajohnson10209)\
**Post date:** [October 4, 2019, 9:38pm UTC](https://discuss.elastic.co/t/querying-date-range-data-type/202394/1 "2019-10-04T21:38:57Z")

</div>

Hey guys,

Very basic question. I have a date-range mapping for a field with gte : 7pm and lte :10pm (in epoch\_millis) for example. I want to make a query that looks at the current server time (with now) and will return the example doc is now is between gte and lte. I'm having trouble with this. Is this not how you are supposed to use a date range type? Would I be better suited breaking my field into two fields, start\_time and end\_time, then doing a range query on those two fields?

---

<div class="post-metadata">

**Author:** ![gabriel\_tessier](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gabriel_tessier/32/27911_2.png) [@gabriel\_tessier](https://discuss.elastic.co/u/gabriel_tessier)\
**Post date:** [October 7, 2019, 4:17am UTC](https://discuss.elastic.co/t/querying-date-range-data-type/202394/2 "2019-10-07T04:17:29Z")

</div>

Hi @ajohnson10209

You can check here about an example:  
[https://www.elastic.co/guide/en/elasticsearch/reference/7.4/range.html](https://www.elastic.co/guide/en/elasticsearch/reference/7.4/range.html)

If you post an example of your data and what you tried so far we may provide more help.

---

<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 4, 2019, 4:17am UTC](https://discuss.elastic.co/t/querying-date-range-data-type/202394/3 "2019-11-04T04:17:32Z")

</div>

Closed on November 4, 2019, 4:17am UTC

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