# How to set the timerange from 12:00 AM to 11:59 PM for search in watcher json file

**URL:** <https://discuss.elastic.co/t/how-to-set-the-timerange-from-12-00-am-to-11-59-pm-for-search-in-watcher-json-file/178439>\
**Category:** Kibana\
**Created:** [April 25, 2019, 11:24am UTC](https://discuss.elastic.co/t/how-to-set-the-timerange-from-12-00-am-to-11-59-pm-for-search-in-watcher-json-file/178439 "2019-04-25T11:24:36Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mohanraj](https://avatars.discourse-cdn.com/v4/letter/m/bbe5ce/32.png) [@Mohanraj](https://discuss.elastic.co/u/Mohanraj)\
**Post date:** [April 25, 2019, 11:24am UTC](https://discuss.elastic.co/t/how-to-set-the-timerange-from-12-00-am-to-11-59-pm-for-search-in-watcher-json-file/178439/1 "2019-04-25T11:24:36Z")

</div>

I am trying to collect the count of a specific text from our indices for the past one day (12 am to 11:59 PM) and send the count details by email next day 6 am.  
how to do specify the timerange in the search section. do we have any examples ?  
for example, the below example will start the search from the current time and not from 12 am.  
"range": {  
"@timestamp": {  
"from": "now-5m"  
}

---

<div class="post-metadata">

**Author:** ![Larry\_Gregory](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/larry_gregory/32/34969_2.png) [@Larry\_Gregory](https://discuss.elastic.co/u/Larry_Gregory)\
**Post date:** [April 25, 2019, 3:41pm UTC](https://discuss.elastic.co/t/how-to-set-the-timerange-from-12-00-am-to-11-59-pm-for-search-in-watcher-json-file/178439/2 "2019-04-25T15:41:38Z")

</div>

@Mohanraj,

You can use the `/d` operator to round down to the nearest day. To get all of yesterday, you could do something like this:

```auto
"range": { 
     "@timestamp" : { 
         "gte": "now-1d/d",
         "lt": "now/d"
    }
}

```

---

<div class="post-metadata">

**Author:** ![Mohanraj](https://avatars.discourse-cdn.com/v4/letter/m/bbe5ce/32.png) [@Mohanraj](https://discuss.elastic.co/u/Mohanraj)\
**Post date:** [April 29, 2019, 9:57am UTC](https://discuss.elastic.co/t/how-to-set-the-timerange-from-12-00-am-to-11-59-pm-for-search-in-watcher-json-file/178439/3 "2019-04-29T09:57:52Z")

</div>

Hi Larry, Thanks for the details.  
Unfortunately this command didnt work for me but i have modified like this and it worked.  
"range": {  
"@timestamp": {  
"from": "now-1d"  
}  
}

---

<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:** [May 27, 2019, 9:57am UTC](https://discuss.elastic.co/t/how-to-set-the-timerange-from-12-00-am-to-11-59-pm-for-search-in-watcher-json-file/178439/4 "2019-05-27T09:57:57Z")

</div>

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