# Turn off Alert during night

**URL:** https://discuss.elastic.co/t/turn-off-alert-during-night/281156
**Category:** Kibana
**Tags:** elastic-stack-alerting
**Created:** [August 12, 2021, 6:35am UTC](https://discuss.elastic.co/t/turn-off-alert-during-night/281156 "2021-08-12T06:35:44Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![wlbsxnlp22](https://avatars.discourse-cdn.com/v4/letter/w/f17d59/32.png) [@wlbsxnlp22](https://discuss.elastic.co/u/wlbsxnlp22)
#### Post date: [August 12, 2021, 6:35am UTC](https://discuss.elastic.co/t/turn-off-alert-during-night/281156/1 "2021-08-12T06:35:44Z")

</div>

Hi,  
Is there a way to use the Elasticsearch Query Alert type to only run an alert during business hours? If so does anyone have an example script?

Any help would be very appreciated.

---

<div class="post-metadata">

### Author: ![Aaron\_Caldwell](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/aaron_caldwell/32/45755_2.png) [@Aaron\_Caldwell](https://discuss.elastic.co/u/Aaron_Caldwell)
#### Post date: [August 13, 2021, 10:21pm UTC](https://discuss.elastic.co/t/turn-off-alert-during-night/281156/2 "2021-08-13T22:21:22Z")

</div>

Hello,

I don't believe there's currently a way to provide times alert monitoring is active vs. not. That might be worth an [enhancement request](https://github.com/elastic/kibana/issues/new?assignees=&labels=&template=Feature_request.md) though!

A workaround that might work would be to create the alert as an [elasticsearch query alert](https://www.elastic.co/guide/en/kibana/7.x/rule-type-es-query.html) and specify a timestamp (assuming your index has timestamps on each document) within a certain range as part of the query criteria. The rule would still check at whatever your predefined interval is, but it shouldn't return any results if the timestamps are outside of the range you've defined. You'll have to get a little creative with the [date math](https://www.elastic.co/guide/en/elasticsearch/reference/current/common-options.html#date-math) but it should be doable.

Regards,  
Aaron

---

<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: [September 10, 2021, 10:21pm UTC](https://discuss.elastic.co/t/turn-off-alert-during-night/281156/3 "2021-09-10T22:21:37Z")

</div>

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