OpenSearch/docs/painless/painless-contexts/painless-watcher-context-va...

41 lines
1.3 KiB
Plaintext
Raw Normal View History

The following variables are available in all watcher contexts.
*Variables*
`params` (`Map`, read-only)::
User-defined parameters passed in as part of the query.
`ctx['watch_id']` (`String`, read-only)::
The id of the watch.
`ctx['id']` (`String`, read-only)::
The server generated unique identifer for the run watch.
`ctx['metadata']` (`Map`, read-only)::
Metadata can be added to the top level of the watch definition. This
is user defined and is typically used to consolidate duplicate values
in a watch.
`ctx['execution_time']` (`ZonedDateTime`, read-only)::
The time the watch began execution.
`ctx['trigger']['scheduled_time']` (`ZonedDateTime`, read-only)::
The scheduled trigger time for the watch. This is the time the
watch should be executed.
`ctx['trigger']['triggered_time']` (`ZonedDateTime`, read-only)::
The actual trigger time for the watch. This is the time the
watch was triggered for execution.
`ctx['payload']` (`Map`, read-only)::
The accessible watch data based upon the
{xpack-ref}/input.html[watch input].
*API*
The standard <<painless-api-reference, Painless API>> is available.
To run this example, first follow the steps in
<<painless-context-examples, context examples>>.