# Where to add additional watcher scripts?

**URL:** <https://discuss.elastic.co/t/where-to-add-additional-watcher-scripts/179539>\
**Category:** Elasticsearch\
**Tags:** elastic-stack-alerting\
**Created:** [May 3, 2019, 1:20pm UTC](https://discuss.elastic.co/t/where-to-add-additional-watcher-scripts/179539 "2019-05-03T13:20:33Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![6tUBp3gwd9Zp](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/6tubp3gwd9zp/32/45240_2.png) [@6tUBp3gwd9Zp](https://discuss.elastic.co/u/6tUBp3gwd9Zp)\
**Post date:** [May 3, 2019, 1:20pm UTC](https://discuss.elastic.co/t/where-to-add-additional-watcher-scripts/179539/1 "2019-05-03T13:20:33Z")

</div>

These sample watchers from [here](https://github.com/elastic/examples/tree/master/Alerting/Sample%20Watches) have additional scripts for the condition and transform. How do I add these to Kibana when creating a new advanced watcher?

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [May 6, 2019, 7:44am UTC](https://discuss.elastic.co/t/where-to-add-additional-watcher-scripts/179539/2 "2019-05-06T07:44:40Z")

</div>

You can use a dedicated API to store script, see [https://www.elastic.co/guide/en/elasticsearch/reference/7.0/modules-scripting-using.html](https://www.elastic.co/guide/en/elasticsearch/reference/7.0/modules-scripting-using.html)

```auto
POST _scripts/calculate-score
{
  "script": {
    "lang": "painless",
    "source": "Math.log(_score * 2) + params.my_modifier"
  }
}

```

Then you can refer to the script under the name you stored it as.

--Alex

---

<div class="post-metadata">

**Author:** ![6tUBp3gwd9Zp](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/6tubp3gwd9zp/32/45240_2.png) [@6tUBp3gwd9Zp](https://discuss.elastic.co/u/6tUBp3gwd9Zp)\
**Post date:** [May 6, 2019, 10:58am UTC](https://discuss.elastic.co/t/where-to-add-additional-watcher-scripts/179539/3 "2019-05-06T10:58:54Z")

</div>

Thank you. Is it possible to upload and manage these scripts via Kibana (eg. some Upload-Interface)?

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [May 6, 2019, 11:31am UTC](https://discuss.elastic.co/t/where-to-add-additional-watcher-scripts/179539/4 "2019-05-06T11:31:11Z")

</div>

The dev-tools console would be the UI to do so, but that is not a full UI, more of a helper to write JSON.

---

<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:** [June 3, 2019, 11:31am UTC](https://discuss.elastic.co/t/where-to-add-additional-watcher-scripts/179539/5 "2019-06-03T11:31:12Z")

</div>

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