Count the number of occurrences after performing subtraction between two fields

Hi all,

I have an elasticsearch datasource and am using the Grafana plugin.
In my dashboard, I am looking to find the number of docs where “time > 1” with a query that looks like “result: success AND time: >1”.

My issue is that there is a second field called “delay” in the docs which need to be subtracted from time to give me a real time.

Is there a way to specify that I want the query to be performed in this order?:

  1. Calculate “time” as “time - delay”
  2. Then get # of docs where “time > 1”