# Get documents based on timespan

**URL:** <https://discuss.elastic.co/t/get-documents-based-on-timespan/217982>\
**Category:** Elasticsearch\
**Created:** [February 5, 2020, 11:48am UTC](https://discuss.elastic.co/t/get-documents-based-on-timespan/217982 "2020-02-05T11:48:26Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![anandjoshi77](https://avatars.discourse-cdn.com/v4/letter/a/e56c9b/32.png) [@anandjoshi77](https://discuss.elastic.co/u/anandjoshi77)\
**Post date:** [February 5, 2020, 11:48am UTC](https://discuss.elastic.co/t/get-documents-based-on-timespan/217982/1 "2020-02-05T11:48:27Z")

</div>

Hello team,

I have logs with date time stamp.

Is there a way I can get documents with only time range?

For example; can I get documents for a selected date range which has time stamp between 1200-1700 ?

Thanks.

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [February 5, 2020, 12:03pm UTC](https://discuss.elastic.co/t/get-documents-based-on-timespan/217982/2 "2020-02-05T12:03:28Z")

</div>

You need to solve that problem at index time by indexing time as a separate field.

---

<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:** [March 4, 2020, 12:03pm UTC](https://discuss.elastic.co/t/get-documents-based-on-timespan/217982/3 "2020-03-04T12:03:32Z")

</div>

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