22

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.

Keith Pinson
  • 7,835
  • 7
  • 61
  • 104
NickJHoran
  • 597
  • 4
  • 13
  • This is kind of similar to: http://stackoverflow.com/questions/29174113/how-can-i-do-scripted-aggregation-in-kibana-elasticsearch - although not exactly the same. – NickJHoran Apr 15 '15 at 15:29
  • 1
    It sounds like you may want something similar to https://github.com/elastic/elasticsearch/pull/10568 ? – Lee H Apr 16 '15 at 03:13
  • 1
    Cheers for that - I think we're going to take a different approach, taking the raw data from Elasticsearch and importing it into another tool. – NickJHoran Apr 23 '15 at 09:43
  • 1
    Nick, what is the name of that another tool? – zie1ony Oct 28 '15 at 09:11
  • Are **Metric 1** and **Metric 2** are fields in your document? – tonymontana Jul 25 '16 at 13:30
  • Hi @mrvincenzo - they were results of aggregations. We resolved this problem by building a script that talked to ES, grabbed the values of the aggregations and calculated the conversion rates. – NickJHoran Jul 26 '16 at 14:20
  • @NickJHoran Sounds good. The script that grabbed the aggregations was a Kibana script (running from Kibana's scripted field)? I am just looking for ways to perform aggregations from scripted field in Kibana. Thanks! – tonymontana Jul 27 '16 at 08:35
  • 1
    @NickJHoran Could you please answer your question it will be very helpful for us. – 54l3d Jul 28 '16 at 10:03
  • @NickJHoran solution? – Basit Oct 27 '16 at 02:32
  • Hi @Basit, we actually built a little node.js app which retrieved the results from elastic search and then we post-processed the data in code. So we were not able to do this within Kibana. We've since moved to using another product which gives us those stats without us having to perform the calculations ourselves. – NickJHoran Oct 27 '16 at 07:33
  • I've had the same issue and solved it by writing a custom plugin, you can download it here: https://github.com/ommsolutions/kibana_ext_metrics_vis – olsn Oct 31 '16 at 09:45

1 Answers1

1

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.

Daniel Holmes
  • 342
  • 1
  • 2
  • 13