How to define custom terms inside of condition section of watcher

I have a working watch script with trigger, input, condition, and action. The input section has significant logic and the condition is hard coded to true. I would like to change that.

The input section has a transform with a complex chain block. It creates new terms which are used by the scripts that live inside of the input section.

I want to duplicate all of that logic (minus the input scripts) into the condition section. However I have not seen an examples. Examples simply access simple elastic fields.

Any tips for moving custom terms into a condition block? Is my issue syntactical or is it not possible?

The following closed thread discusses the same problem that I am having. Unlike the poster, my JSON appears to be valid:

I am not sure I fully got your issue, let me try to rephrase and feel free to correct me.

  1. You have a script running as part of a transform (in a chained input)
  2. You now don't want to rerun the same part in the script condition

How about writing something into the payload as part of your transform, so that the condition can simply check this particular field for false or true?

If I misunderstand, please share a watch, and more details including your expectations, I think that may help a bit.


I simply needed to return the value from the last executed input script before my condition script. I failed to realize that they needed to be returned at each level of a transform chain and accessed like ctx.payload.myField. Thanks.

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