Calculate a new field into new index

I am displaying my data in grafana using elasticseach as a datasource and using a plugin there called metaqueries to help do a calculation on elasticsearch's field like:

A: queryA
B: queryB
C: queryC
D: (A+B) / C

I am able to display the data correctly on a graph, but unfortunately this plugin does not support setting an alert so I am looking for an alternative way.

What I am thinking of is to calculate the fields in elasticsearch from multiple different queries and add that calculated field into a new index, I thought of using a job that runs a program which queries from elasticsearch, calculate the field and add it back into a new index which I will then use in grafana to display in a graph.

Is there any way I can do this calculation in kibana instead?

Hi @shifenglim ,

welcome to the Kibana community.
In Kibana there's the Lens editor which, since version 7.14, provides a new feature called "Formula" which enables math on field aggregations: Lens | Kibana Guide [7.14] | Elastic

Of course this depends on the type of queries you are currently using. Do you have more information about that?

1 Like

Hi Marco, thanks for the reply,
It looks good however I am unsure if this actually creates the data in a new index to be use somewhere (Grafana) else or is this aggregated view only available in kibana's dashboard.

Formulas will make the computation available only on the Kibana visualization side.

If you want to create new summary index with computation results you can have a look at Transforms: Transforming data | Elasticsearch Guide [7.14] | Elastic

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.