Issue while plotting percentage in Kibana


I got stucked at one place and need your help to display data into visulizaiton.

Here is my sample document:

"@timestamp": 1512606017619,
"id": "2odalecgvg9f58vdm8e6vgoc2p",
"scenario": "Test scenario",
"scenarioDetails": "3300AB8D178C130D --> CE0617169CAE2F02017E",
"Value A" : 1,
"Value B" : 2,
"Value C" : 3,
"Value D" : 4

Now I need to display percentage for each scenario into graph i.e.

Percentage(%) = (TotalCount(Value A) / TotalCount(Value B))*100

I tried a lot but coudn't able to plot it into any visualization.

Please help me to sort this out.

Hi there,

When you do something like TotalCount(ValueA) I'm assuming you're aggregating all of the ValueA values for the documents within a certain time range. To transform that value we'd need to run some kind of script on it. Unfortunately, we don't currently support scripts for aggregations. See Scripted field on Aggregated value for a similar question.

I'm a little confused by your question though, because it seems like the Percentage result you're looking for would be a single value for a given time range, and not a value which changes over time. How were you planning on plotting this on a chart? What would you like your X-Axis to be?



I really appreciate for your prompt reply. Well my requirement is I need to calculate percentage from logged data and plot it into chart. Here I am facing couple of concern like which type of charting I should use as mostly all charts aggregate function and which is preventing me to select field. Second major thing is using scripting I can calculate percentage but neither I able to save that script nor I can create chart from that script.

Here I have attached a sample image which illustrate scenario. Is it possible to achieve using Kibana visualization?

Sample Chart

Ah of course! That image clears things up for me and now I feel a bit silly I didn't think of that originally. The Horizontal Bar Chart visualization will let you create a chart like this. But Kibana is currently limited to visualizing certain types of buckets, e.g. terms or a date histogram. We need to add functionality support bucketing with scripts before this exact chart can be built.


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