condition.asciidoc 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. [role="xpack"]
  2. [[condition]]
  3. == Conditions
  4. When a watch is triggered, its condition determines whether or not to execute
  5. the watch actions. {watcher} supports the following condition types:
  6. * <<condition-always,`always`>>: set the watch condition to `true` so the watch
  7. actions are always executed.
  8. * <<condition-never,`never`>>: set the watch condition to `false` so the watch
  9. actions are never executed.
  10. * <<condition-compare,`compare`>>: perform simple comparisons against values
  11. in the watch payload to determine whether or not to execute the watch actions.
  12. * <<condition-array-compare,`array_compare`>>: compare an array of values in the
  13. watch payload to a given value to determine whether or not to execute the watch
  14. actions.
  15. * <<condition-script,`script`>>: use a script to determine whether or not to
  16. execute the watch actions.
  17. NOTE: If you omit the condition definition from a watch, the condition defaults
  18. to `always`.
  19. When a condition is evaluated, it has full access to the watch execution context,
  20. including the watch payload (`ctx.payload.*`). The <<condition-script,script>>,
  21. <<condition-compare,compare>> and <<condition-array-compare,array_compare>>
  22. conditions can use the payload data to determine whether or not the necessary
  23. conditions are met.
  24. In addition to the watch wide condition, you can also configure conditions
  25. per <<action-conditions,action>>.
  26. include::condition/always.asciidoc[]
  27. include::condition/never.asciidoc[]
  28. include::condition/compare.asciidoc[]
  29. include::condition/array-compare.asciidoc[]
  30. include::condition/script.asciidoc[]