# Range query

**URL:** <https://discuss.elastic.co/t/range-query/275116>\
**Category:** Elasticsearch\
**Created:** [June 7, 2021, 7:52am UTC](https://discuss.elastic.co/t/range-query/275116 "2021-06-07T07:52:25Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gokul6](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gokul6/32/84049_2.png) [@Gokul6](https://discuss.elastic.co/u/Gokul6)\
**Post date:** [June 7, 2021, 7:52am UTC](https://discuss.elastic.co/t/range-query/275116/1 "2021-06-07T07:52:25Z")

</div>

i am using the below range query to read data from elasticsearch using **spark** and in kibana i have set **Asia/Riyadh** Timezone for date formatting.  
.set("es.query","""{  
"query": {  
"range": {  
"@timestamp": {  
"gte": "now-1h",  
"lte": "now"  
}  
}  
}  
}""")  
but this query is fetching me wrong results. while running this code the time was 10.49AM in Riyadh and i am getting the results from 6.52AM. below is my output.please help 🙂  
 ![data](https://us1.discourse-cdn.com/elastic/original/3X/b/0/b0a721ae429f7aaa95f271ccbcb086486dfa20a9.png)

---

<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:** [June 7, 2021, 8:06am UTC](https://discuss.elastic.co/t/range-query/275116/2 "2021-06-07T08:06:23Z")

</div>

Riyadh is UTC+3.  
You ran the code at 10:49AM. Which means 7:49AM UTC.

You asked fro now-1H to now, which means from 06:49AM to 07:49AM.

The result looks good to me as 06:52AM is in this range.

---

<div class="post-metadata">

**Author:** ![Gokul6](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gokul6/32/84049_2.png) [@Gokul6](https://discuss.elastic.co/u/Gokul6)\
**Post date:** [June 7, 2021, 8:13am UTC](https://discuss.elastic.co/t/range-query/275116/3 "2021-06-07T08:13:21Z")

</div>

@dadoonet Thank you for clarifying.

---

<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, 2021, 8:14am UTC](https://discuss.elastic.co/t/range-query/275116/4 "2021-07-05T08:14:19Z")

</div>

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