Graph Sum based on average


My indices have this records:

Name	Type	IO		
bay01	diskA	0		
bay01	diskA	20		
bay01	diskB	0		
bay01	diskB	40		
bay03	diskC	0		
bay03	diskC	10		
bay03	diskD	30		
bay03	diskD	60		

A. I need to graph an average on the IO value group by Type,Name:
It's show:

Name	Type	Average IO	
bay01	diskA	10		
bay01	diskB	20		
bay02	diskC	5		
bay02	diskD	45		

I don't have problem to graph this value;

B. Then I need a second graph sum of IO group by Name
But, this sum must use the average of the precedent graph.
I need to have this value:

Name	 	Sum  IO based on Average Io
bay01		30		
bay02		50		

So in conclusion in this graph I need the sum of IO based on item average.

I don't find in Kibana how I can do that.
The uniq possibility that i find is to do sum. But it show this result and not that I want.

Name	 	Sum IO	
bay01		100		
bay02		80		

Help please! :slight_smile:

You cannot currently do this. I think there is a issue on Github for it though!

I'm not sure why you would want to take the sum of the averages. It seems misleading. The average for bay01 is (0+20+0+40)/4 = 15 (which is also the average of 10 and 20 from part A). And you should be able to get that using Kibana.

I don't need the average of bay01,

I need the average of DISKA, DISKB, DISKC, DISKD;

then the sum of disk/bay
Sum of bay01 = diskA+diskB
Sum of bay02 = diskC+diskD.

concretely , I need to calculate the IOs of a SAN datastore .
For that I have to calculate IOs average for each datastore for a bay . Then I need to calculate the number of IOs of a storage array that is the sum of IOs / datastore.

OK, then I agree with Mark's earlier comment, it's not currently possible. In Kibana you can have multiple buckets for aggregation but they all use the same type of aggregation. You need to be able to switch them between Average and Sum.

A possible hack that might work, would be to create your visualization using either Sum or Average, and then go to the Settings -> Objects, find your visualization, and edit the visState field. Right now I see there's just one "aggs" setting for 2 levels of buckets. You might be able to re-write that query so that one bucket used Sum and one used Average. And Kibana might render the results correctly. No guarantees that it would work though. It might be best to test out the query using the Sense console.