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