Watcher name and description

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

you could use the metadata field for this.

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

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

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" : ...
}

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

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?

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