Computation on aggregation fileds


(suresh) #1

HI

Input
state,days
johar,2
johar,1
johar,3
johar,7
johar,6
johar,12
pk,2
pk,4
pk,9

have data as above from this want to compute fields like days which are <=3 days and <=10 days computed fields for that i created scripted fields like

3 days(painless)
if (doc['days'].value <= 3){
return 1
}

10 days(painless)
if (doc['days'].value <= 10){
return 1
}

Able to get the 3days ,10days and total by using scripted fileds But need percentage as shown below that not able to figure out what is the way in kibana to achieve this?

Output
state,Total(count),3days,% 3days,10days,%10days
johar,6,3,3/6,5,5/6
pk,2,1,1/2,2,2/2

Please can u guys say can we able to achieve this in kibana


(Peter Pisljar) #2

it should be possible with timelion where you can do things like

 .es(metric=sum:3days), 
 .es(metric=sum:10days), 
 .es(metric=sum:3days).divide(.es(metric=count))
 ...

(suresh) #3

Hi,

ok we can do using timeline but i need based on state not on timeline.
can we do any terms aggregation in timeline?

Thanks,


(Peter Pisljar) #4

unfortunately timelion is limited to time series


(suresh) #5

HI,

so there is no possibility to achieve this scenario?

Thanks


(Peter Pisljar) #6

not that i am aware of. with exception of timelion and time series visual builder which are both time based its not possible to calculate ratios.


(system) #7

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