Kibana Watcher - Using it to calculate a percentage of two result values

I am trying to use a watcher to parse email event data, we have a field that will state if the email delivery is successful/delayed/ failed.

I want to know if it is possible to calculate the percentage of failed messages vs the successful for example.

For example, I would want to run a script following this route:

    "condition": {
      "script": {
          "source": "return (ctx.payload.traffic.hits.hits._source.dsnAction.failed * 100 / ctx.payload.traffic.hits.total) >= 2",
            "lang": "painless"        
        }
    }

Is this possible? ctx.payload.traffic.hits.hits._source.dsnAction.failed is an example

Thanks

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