Changing Conditions

Watcher supports four types of conditions always, never, compare, and script.

The first two are pretty self-explanatory—​they are shortcuts for setting a watch’s condition to true or false.

The compare condition enables you to perform simple comparisons against values in the Watch payload. While you can also do this with a script condition, with compare you can define inline comparisons without having to enable dynamic scripting. You can use the script condition to perform more complex evaluations of the data in the watch payload.

For example, the following compare condition checks to see if the search input returned any hits:

"condition" : {
    "compare" : { "ctx.payload.hits.total" : { "gt" : 0 }}
  },