# Watcher name and description

**URL:** <https://discuss.elastic.co/t/watcher-name-and-description/210408>\
**Category:** Elasticsearch\
**Tags:** elastic-stack-alerting\
**Created:** [December 3, 2019, 5:38pm UTC](https://discuss.elastic.co/t/watcher-name-and-description/210408 "2019-12-03T17:38:20Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![luksi1](https://avatars.discourse-cdn.com/v4/letter/l/e68b1a/32.png) [@luksi1](https://discuss.elastic.co/u/luksi1)\
**Post date:** [December 3, 2019, 5:38pm UTC](https://discuss.elastic.co/t/watcher-name-and-description/210408/1 "2019-12-03T17:38:20Z")

</div>

Am I missing something in the Watcher API? I don't see any way to add a name with spaces or a description via the API.

[https://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-put-watch.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-put-watch.html)

---

<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:** [December 4, 2019, 1:05pm UTC](https://discuss.elastic.co/t/watcher-name-and-description/210408/2 "2019-12-04T13:05:43Z")

</div>

you could use the `metadata` field for this.

---

<div class="post-metadata">

**Author:** ![luksi1](https://avatars.discourse-cdn.com/v4/letter/l/e68b1a/32.png) [@luksi1](https://discuss.elastic.co/u/luksi1)\
**Post date:** [December 5, 2019, 12:20pm UTC](https://discuss.elastic.co/t/watcher-name-and-description/210408/3 "2019-12-05T12:20:35Z")

</div>

Any possibility you could provide a simple example for how the metatata values would look?

---

<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:** [December 6, 2019, 12:03pm UTC](https://discuss.elastic.co/t/watcher-name-and-description/210408/4 "2019-12-06T12:03:35Z")

</div>

```auto
PUT _watcher/watch/<watch_id>
{
  "metadata" : {
    "foo" : "bar",
    "spam" : { "eggs" : 123 }
  },
  "trigger" : ...
  "input" : ...
  "condition" : ...
  "actions" : ...
}
```

---

<div class="post-metadata">

**Author:** ![luksi1](https://avatars.discourse-cdn.com/v4/letter/l/e68b1a/32.png) [@luksi1](https://discuss.elastic.co/u/luksi1)\
**Post date:** [December 6, 2019, 1:11pm UTC](https://discuss.elastic.co/t/watcher-name-and-description/210408/5 "2019-12-06T13:11:32Z")

</div>

So I can simply insert the description and name in the metadata and voilá my name and description will appear in the watcher? Seems like metadata information would simply be available for the duration of the REST call for use in, for instance, the ctx.payload. It feels like I'm missing something.

```
PUT _watcher/watch/<watch_id>
{
  "metadata" : {
    "name" : "My cool watcher",
    "description" : "This is a super cool watcher."
  },
  "trigger" : ...
  "input" : ...
  "condition" : ...
  "actions" : ...
}
```

---

<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:** [December 9, 2019, 1:29pm UTC](https://discuss.elastic.co/t/watcher-name-and-description/210408/6 "2019-12-09T13:29:00Z")

</div>

what do you mean `appear in the watcher` here? It is available via `ctx.metadata` in your watch, whenever you use scripting.

---

<div class="post-metadata">

**Author:** ![luksi1](https://avatars.discourse-cdn.com/v4/letter/l/e68b1a/32.png) [@luksi1](https://discuss.elastic.co/u/luksi1)\
**Post date:** [December 9, 2019, 2:58pm UTC](https://discuss.elastic.co/t/watcher-name-and-description/210408/7 "2019-12-09T14:58:17Z")

</div>

When defining a watcher in the GUI in Kibana, you can define the name, ID, and the description of the watcher. When making a PUT request to create the watcher, you can define an ID, but there are no options to define the name or the description.

You mentioned that you can define a name and description as metadata as an answer, but metadata is simply a Map added as a contant that can be used either in a transform, action, condition or input (as I understand it from the docs).

I'm guessing that this option is just not currently available?

---

<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:** [January 6, 2020, 2:58pm UTC](https://discuss.elastic.co/t/watcher-name-and-description/210408/8 "2020-01-06T14:58:18Z")

</div>

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