Getting the transformed data into condition in kibana watcher


I am currently developing a kibana watcher alert and I am comparing two values to generate an email if the condition comes true. For that I calculated an average value and it comes with many decimal places (nearly 20). I found that it can be rounded into several decimal places from transform section. I have tried it and I got the results as well. Now I need to add those transformed results to the condition section. I have tried ctx.transform.payload to access the transformed payload but it results a null. So is there anything I am missing when accessing the transformed payload?


a transform is always executed after the condition.

Hi @spinscale,

Thanks for the quick reply. Is there any way to round the aggregation payload before the condition and compare those rounded data inside the condition?


Can you maybe explain, why you want to compare a rounded result vs a non rounded one? Interested behind the use-case here and why that is necessary.

That said, you can execute any logic in the script condition and of course round to anything you want before that as well.

This is the use case. The average value from the aggregation contains many decimal places (nearly 20) but I need that average value in three decimal places and compare it with another value. This is the reason that I want to round the average value. Please feel free to ask for any clarifications.

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