Get difference between two datetime fields

Hi,

I am trying everything and i dont get to graph the difference between two datetime fields in a document, and then be able to count how many docs the difference is greater than 1 minute for instance.

In elasticsearch this can be done by scripted fields:

{
  "script_fields": {
    "test1": {
      "script": "(doc['delivertime'].date.millis - doc['submittime'].date.millis)/1000"
    }
  }
}

How could this be done in grafana??
I am trying metric’s script options and nothing … I am starting to consider to add a new field in logstash.

Thanks in advance

1 Like