ES 2.1.1. I am keeping some state info in ctx.vars, set in a transform.
Then check for some conditions in ctx.vars,
apparently can't be accessed within
but can be accessed within actions and subsequent inputs.
"script": "ctx.vars.userid = ctx.payload.hits.hits._source.user.id; ctx.vars.lang = ctx.payload.hits.hits._source.lang;"
the following returns true (note the hard-coded 'tr') :
"script" : "return ctx.payload.hits.hits._source.lang.equals('tr') ; "
but this is not.
"script" : "return ctx.vars.lang.equals('tr') ; "
actions, i can access ctx.vars without any issue.
I think somehow
condition cannot read ctx.var.
Could anyone confirm?
a transform is only supposed to modify the payload. You should have access to that in the actions as well and/or use a chained input?
Wondering about the use-case here, interested in the example to see what does not work that way.
Actually, I was inspired by this post:
conditionsupports scripting, they should have access to
ctx.vars. Is this falsified already or still valid, wondering, especially the vendor perspective would be important here as this is a commercial component.
The use case is very significant I think, such as increasing dimensionality of watch evaluations by causal relationships. In that sense, chain inputs and chain transforms together would provide with huge flexibility and would expand the usability of watcher, which is a huge step. Kudos for that.
(But at my small step here now, I am still kinda stuck!)
I am still doing some more tests on that but my eval license has expired :shame: .
After some workarounds, I realize a powerful event processor is ready. Thanks for your support.
happy to hear, you got it working. If you have an interesting use-case to share, we are all ears