How to Calculate Time Difference Between Two Timestamps in Grafana Using Elasticsearch Data Source

Hi community,

I’m working on a dashboard using Grafana with Elasticsearch as the data source. I need to calculate the difference between two timestamp fields (timestamp1 and current time) and display this difference on the dashboard.

My Questions:

  1. What’s the best way to calculate the time difference between two timestamps in Grafana using Elasticsearch as the data source?

  2. Can someone provide a step-by-step guide on how to implement this in Grafana?

  3. Are there any other approaches for this type of calculation, if the scripted fields in Elasticsearch aren’t storing correctly?

can you post a table view of the two timestamps data?

I have a timestamp field in my Elasticsearch index, and I want to calculate the difference in seconds between this timestamp and the current time.