'Convert log threshold rule to Elasticsearch query rule

I have a Log threshold rule in Kibana using ratio. It means that I'm dividing query A in query B, and sending an alert in case the result is less than 86%.

For example:

WHEN THE ratio OF QUERY A TO B QUERY
IS less than 0.86
FOR THE LAST 1 day
GROUP BY worker_action

QUERY A
WITH labels.state IS Completed
AND worker_action IS testing

QUERY B
WITH worker_action IS testing
AND worker_action IS NOT testing

I need to convert those actions to an Elasticsearch query. Any ideas on how I can do that?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source