# Script is not working properly

**URL:** <https://discuss.elastic.co/t/script-is-not-working-properly/51386>\
**Category:** Elasticsearch\
**Created:** [May 31, 2016, 7:08am UTC](https://discuss.elastic.co/t/script-is-not-working-properly/51386 "2016-05-31T07:08:39Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rajnikant](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rajnikant/32/6490_2.png) [@Rajnikant](https://discuss.elastic.co/u/Rajnikant)\
**Post date:** [May 31, 2016, 7:08am UTC](https://discuss.elastic.co/t/script-is-not-working-properly/51386/1 "2016-05-31T07:08:39Z")

</div>

I am trying to get range of hours but i did not get.  
In my data date format is:- 2016-05-19T04:00:00+03:00  
My Sample code is:-  
GET trafficreports1/pyeventlog/\_search?size=1000  
{  
"query": {  
"filtered": {  
"filter": {  
"bool": {  
"must": [  
{  
"range": {  
"LocalTimestamp": {  
"gte": "2016-05-19T04:00:00+03:00",  
"lte": "2016-05-20T11:00:00+03:00"  
}  
}  
},  
{  
"script": {  
"script": "doc['LocalTimestamp'].date.getHourOfDay() \< min",  
"params": {  
"min":7  
}  
}  
}  
]  
}  
}  
}  
},  
"sort" : [  
{ "LocalTimestamp" : "asc" }  
]  
}

---

<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, 2017, 10:47pm UTC](https://discuss.elastic.co/t/script-is-not-working-properly/51386/2 "2017-07-05T22:47:51Z")

</div>


