mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-03-03 09:29:11 +00:00
This commit adds a new compare condition called “array_compare”. This condition enables comparing a single resolved value to an array of resolved values. The value can be compared for equality, non-equality, and strict and non-strict ordering; the array compare condition will evaluate to true if the value compares to true with respect to the specified operator against all (“all”) or at least one (“some”) of the values in the array specified by “array_path”. Each value in the array can be resolved to a value using “path” (e.g., “array_path”: “cx.payload.aggregations.some_field.buckets” and “path”: “doc_count” would resolve each value in the buckets array to its “doc_count”). Closes elastic/elasticsearch#345 Original commit: elastic/x-pack-elasticsearch@0d74b4dc11
23 lines
938 B
Plaintext
23 lines
938 B
Plaintext
[[condition]]
|
|
=== Condition
|
|
|
|
When a watch is triggered, its condition determines whether or not to execute its actions.
|
|
Watcher supports four condition types: <<condition-always, `always`>>, <<condition-never, `never`>>,
|
|
<<condition-script, `script`>> and <<condition-compare, `compare`>>.
|
|
|
|
NOTE: If you omit the condition definition from a watch, the condition defaults to `always`.
|
|
|
|
When a condition is evaluated, it has full access to the watch execution context, including the watch payload (`ctx.payload.*`).
|
|
The <<condition-script, script>>, <<condition-compare, compare>> and <<condition-array-compare, array-compare>>
|
|
conditions can use the data in the payload to determine whether or not the necessary conditions have been met.
|
|
|
|
include::condition/always.asciidoc[]
|
|
|
|
include::condition/never.asciidoc[]
|
|
|
|
include::condition/script.asciidoc[]
|
|
|
|
include::condition/compare.asciidoc[]
|
|
|
|
include::condition/array-compare.asciidoc[]
|