# Elastics search date range issue

**URL:** https://discuss.elastic.co/t/elastics-search-date-range-issue/298364
**Category:** Kibana
**Tags:** elastic-stack-alerting
**Created:** [February 27, 2022, 8:06pm UTC](https://discuss.elastic.co/t/elastics-search-date-range-issue/298364 "2022-02-27T20:06:14Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![riya9](https://avatars.discourse-cdn.com/v4/letter/r/b5a626/32.png) [@riya9](https://discuss.elastic.co/u/riya9)
#### Post date: [February 27, 2022, 8:06pm UTC](https://discuss.elastic.co/t/elastics-search-date-range-issue/298364/1 "2022-02-27T20:06:14Z")

</div>

Hello,

I am newbie to Kibana and having hard time to create an alert for job which is not in success state for last 90 min ..am trying below query but somehow when using "gte": "now-90m", it get converted to below in extraction query every time when i try to run the alert and does not give the right result as it is looking into entire file not from now : pls suggest what am doing wrong

"range": {  
"LOGS.SCHEDULED\_TIME": {  
"from": "now-90m",  
"to": null,  
"include\_lower": true,  
"include\_upper": true,  
"boost": 1

below is my complete query:

{  
"from": 0,  
"size": 0,  
"query": {  
"bool": {  
"filter": [  
{  
"bool": {  
"must": [  
{  
"bool": {  
"must": [  
{  
"term": {  
"LOGS.NAME.keyword": {  
"value": "TASK\_123",  
"boost": 1  
}  
}  
},  
{  
"term": {  
"LOGS.STATE.keyword": {  
"value": "EXECUTING",  
"boost": 1  
}  
}  
},  
{  
"range": {  
"SCHEDULED\_TIME: {  
"gte": "now-90m",  
"boost": 1  
}  
}  
}  
],  
"adjust\_pure\_negative": true,  
"boost": 1  
}  
}  
],  
"adjust\_pure\_negative": true,  
"boost": 1  
}  
}  
],  
"adjust\_pure\_negative": true,  
"boost": 1  
}  
},  
"\_source": {  
"includes": [  
"COUNT"  
],  
"excludes":   
},  
"aggregations": {  
"COUNT\_0": {  
"value\_count": {  
"field": "\_index"  
}  
}  
}  
}

---

<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 27, 2022, 8:07pm UTC](https://discuss.elastic.co/t/elastics-search-date-range-issue/298364/2 "2022-03-27T20:07:06Z")

</div>

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