# Query Range with Date Data

**URL:** <https://discuss.elastic.co/t/query-range-with-date-data/150565>\
**Category:** Elasticsearch\
**Tags:** elastic-stack-alerting\
**Created:** [October 1, 2018, 12:06pm UTC](https://discuss.elastic.co/t/query-range-with-date-data/150565 "2018-10-01T12:06:25Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Suman\_Reddy1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/suman_reddy1/32/27303_2.png) [@Suman\_Reddy1](https://discuss.elastic.co/u/Suman_Reddy1)\
**Post date:** [October 1, 2018, 12:06pm UTC](https://discuss.elastic.co/t/query-range-with-date-data/150565/1 "2018-10-01T12:06:25Z")

</div>

Hi Team,

Below is my filter configurations.

> "filter": {  
> "range": {  
> "@timestamp": {  
> "gte": "now-5d",  
> "lte": "now-1d"  
> }  
> }  
> }

Requirement is to watch last 5 days data excluding current day.

I have tried multiple options but none seems to be working, as am doing time stamp based query it is including irrelevant data, like till this time.

I need the query to be run like 26-09-2018 to 30-09-2018 without timestamp limitations,

Thanks in advance

---

<div class="post-metadata">

**Author:** ![richcollier](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/richcollier/32/115035_2.png) [@richcollier](https://discuss.elastic.co/u/richcollier)\
**Post date:** [October 1, 2018, 1:09pm UTC](https://discuss.elastic.co/t/query-range-with-date-data/150565/2 "2018-10-01T13:09:03Z")

</div>

Look at the date math and rounding section here: [https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-range-query.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-range-query.html)

---

<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:** [October 29, 2018, 1:09pm UTC](https://discuss.elastic.co/t/query-range-with-date-data/150565/3 "2018-10-29T13:09:04Z")

</div>

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