Divide aggregated metrics to new custom metric

Hi there, is it possible to do basic arithmetic operations in Kibana? Let's say: I've got two metrics aggregated by sum and would like to divide them for a third aggregated custom metric. In the metrics layer there's a possibility to do some pipelining but maybe that's not where it's at?

Hey,

In general you can achieve that in Timelion, by using something like:

.sum(.es(metric=sum:field1), .es(metric=sum:field2)).divide(.es(metric=avg:field3))

That would sum up those two sum aggregateion and finally divide it by the third metric aggregation.

In Visual Builder, but apparently you will need a newer version of Kibana for that, you can find a "Calculation" Parent Pipeline Aggregation, that you can use and assign the result of the three other aggregations and calculate them in any way you want (via a painless script).

Cheers,
Tim

Hi @timroes at the moment I'm on Kibana 5.5.3 but I want to update it to 6.x this week. The "Calculation" Parent Pipeline Aggregation is a 6.x feature? Couldn't find it in the release notes of 6.0 and 6.0.1
With the 3rd metric I would like to do some „excel-like thing“: metric1/metric2*100 but in a table not in timelion. Maybe this is not possible with Kibana Visualisation?

With 6.x you should have some of this kind available. Unfortunately there was some movement in the early 6.x versions about adding, removing, renaming that feature, why I can't tell you exactly which patch version has which version of "Calculation" (or maybe named "Bucket Scripts") in it.

You beside this feature should anyway always update to the most recent Kibana version (at the time of writing 6.1.1).

Cheers,
Tim

Hi @timroes,
I'm now on 6.1.1 and now looking for "Bucket Scripts". Are you talking about this (upcoming) feature called Bucket Script Aggregation? It's not available in 6.1.1, am I right? https://www.elastic.co/guide/en/elasticsearch/reference/master/search-aggregations-pipeline-bucket-script-aggregation.html

Cheers
Hannah

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