How to put the value of {{ctx.payload.aggregations.bucketAgg.buckets}} into Watcher body

Hi,

I have a watcher created and below is a part of the code. I am trying to parse the result of the "script" from the "perc_change" bucket in {{ctx.payload.aggregations.bucketAgg.buckets}} to compare it and based on that compare have an email action setup. But I am unable to parse the result of "script". How can I do that and what am I missing in my condition compare ?

},
                    "perc_change":{
                      "bucket_script": {
                        "buckets_path": {
                          "var1": "count_deriv",
                          "var2":"_count"
                        },
                        "script": "params.var1 / (params.var2 - params.var1) * 100"
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "condition" : {
    "compare": {
      "ctx.payload.aggregations.perc_change.buckets" : { "lt" : 0 }
    }
  },

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