Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Performing Calculations on Multiple Metrics (Counts) in Kibana 4

Tags:

I have a number of separate searches (elasticsearch) that produce simple metric visualisations. Each of these visualisations is a simple total (integer). That's easy enough.

What I'd like to be able to do is work out the conversion rates between pairs of those metrics. As an example:

Metric 1:    Metric 2:    Conversion Calculation:    Conversion Rate: 15312        9760         (9760 / 15312) * 100       63.74% 

It seems like something that should be possible in Kibana 4 but I've just spent several hours playing around with my data (+ searching for examples) but haven't been able to solve this problem.

Has anyone else tried the same thing and had better results? I know that Kibana has scripted fields—but I need some sort of scripted aggregation.

like image 213
NickJHoran Avatar asked Apr 15 '15 14:04

NickJHoran


1 Answers

This looks like scripted fields as described here https://www.elastic.co/blog/kibana-4-beta-3-now-more-filtery


Kibana now includes support for Elasticsearch scripting! Not only can you write scripts, you can name them and access them like fields anywhere in the application. Create a scripted field and it becomes part of the documents you view in Kibana as if it was always there. The only catch is that since the script isn't technically part of the Elasticsearch index, you can not search scripted fields.

You can, however, use scripts to combine several fields, or perform math on number fields, and then drop the result into a visualization. To help get you started, we've added a handy link in the scripted fields screen titled “Create a few examples from your date fields." Find it by heading to the Settings tab's “Index" section. Select or create an index pattern and click the “Scripted Fields" tab.

like image 143
Daniel Holmes Avatar answered Sep 19 '22 06:09

Daniel Holmes