# How to generate Rules for anomaly detection ML?

**URL:** <https://discuss.elastic.co/t/how-to-generate-rules-for-anomaly-detection-ml/285707>\
**Category:** Elasticsearch\
**Tags:** elastic-stack-machine-learning\
**Created:** [October 1, 2021, 6:23pm UTC](https://discuss.elastic.co/t/how-to-generate-rules-for-anomaly-detection-ml/285707 "2021-10-01T18:23:41Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![MLsuper](https://avatars.discourse-cdn.com/v4/letter/m/dfb087/32.png) [@MLsuper](https://discuss.elastic.co/u/MLsuper)\
**Post date:** [October 1, 2021, 6:23pm UTC](https://discuss.elastic.co/t/how-to-generate-rules-for-anomaly-detection-ml/285707/1 "2021-10-01T18:23:42Z")

</div>

When I go to Kibana-\>Alerts and Actions I only see Alerts and Connectors and not Rules, I want to create a rule/generate alerts for anomaly detection(ML job) but I do not see Rules or anomaly detection alert, how do I enable this? thank you

---

<div class="post-metadata">

**Author:** ![richcollier](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/richcollier/32/115035_2.png) [@richcollier](https://discuss.elastic.co/u/richcollier)\
**Post date:** [October 2, 2021, 3:09pm UTC](https://discuss.elastic.co/t/how-to-generate-rules-for-anomaly-detection-ml/285707/2 "2021-10-02T15:09:40Z")

</div>

If by "Rules" you mean "[custom exceptions for Anomaly Detection Jobs](https://www.elastic.co/guide/en/machine-learning/current/ml-rules.html)", then:

Click on the gear icon next to an anomaly for the job in the ML UI:

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/a/4/a4daae3ae8566d22b1a7576166b94ea1102b4ce2.png)

...and you will see the popup:

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/1/b/1bd81017bbca21aed42d1f72ebf367bee5e26033.png)

...which opens the flyout:

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/6/4/647a0d0a3a45e70ccb1cc3653b44fcccb65e97ec.png)

Or if you prefer, you can set rules via the [API](https://www.elastic.co/guide/en/machine-learning/current/ml-configuring-detector-custom-rules.html)

---

<div class="post-metadata">

**Author:** ![richcollier](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/richcollier/32/115035_2.png) [@richcollier](https://discuss.elastic.co/u/richcollier)\
**Post date:** [October 2, 2021, 3:34pm UTC](https://discuss.elastic.co/t/how-to-generate-rules-for-anomaly-detection-ml/285707/3 "2021-10-02T15:34:33Z")

</div>

If you want to create Alerts for ML jobs then go the ML jobs page, click the `...` icon for the job:

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/4/7/471473f7ec4140830a65c17cb561cfbca7f7fe49.png)

and define an alert rule:

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/1/0/100cd2f24a9995ab0b36cfee9d668413ae7ac79c.png)

---

<div class="post-metadata">

**Author:** ![MLsuper](https://avatars.discourse-cdn.com/v4/letter/m/dfb087/32.png) [@MLsuper](https://discuss.elastic.co/u/MLsuper)\
**Post date:** [October 4, 2021, 3:15pm UTC](https://discuss.elastic.co/t/how-to-generate-rules-for-anomaly-detection-ml/285707/4 "2021-10-04T15:15:19Z")

</div>

Is there a specific version of Elasticsearch I need? Both of these options I do no have, for example the second one when i click ... I dont see "Create alert rule" , only start data feed, clone job, edit job, delete job

---

<div class="post-metadata">

**Author:** ![richcollier](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/richcollier/32/115035_2.png) [@richcollier](https://discuss.elastic.co/u/richcollier)\
**Post date:** [October 4, 2021, 3:49pm UTC](https://discuss.elastic.co/t/how-to-generate-rules-for-anomaly-detection-ml/285707/5 "2021-10-04T15:49:11Z")

</div>

The alerts for ML were revamped from using Watcher to using Kibana Rules/Alerts starting in v7.12 I believe. The above are screenshots from v7.15

---

<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:** [November 1, 2021, 3:49pm UTC](https://discuss.elastic.co/t/how-to-generate-rules-for-anomaly-detection-ml/285707/6 "2021-11-01T15:49:21Z")

</div>

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