Hi, I am new to Kibana and I have questions about few operations that I would like to hear suggestions.
I have a json with 3 fields:
field_1(date),field_2(total_time),field_3(qty)
1/1/2018 , 23 , 1
1/2/2018 , 46 , 2
1/3/2018, 5 , 3
1/4/2018, 12 , 4
1/5/2018, 100 , 4
I am trying to get a scripted field to get the following calculation done:
- sort the data based on field_2(total_time).
- Percentile calculation based on field_3(qty) after sorting the data
- get max(field_2-total_time) that is less than 90% of the field_3(qty) percentile calculation.
Step 1: Sorted data:
field_1(date),field_2(total_time),field_3(qty),
1/3/2018 , 5 , 3
1/4/2018 , 12 , 4
1/1/2018, 23 , 1
1/2/2018, 46 , 2
1/5/2018, 100 , 5
Step 2: Percentile calculation:
field_1(date),field_2(total_time),field_3(qty),field_4(cusum_qty),field_5(percentile)
1/3/2018 , 5 , 3 , 3 , 0.20
1/4/2018 , 12 , 4 , 7 , 0.46
1/1/2018, 23 , 1 , 8 , 0.53
1/2/2018, 46 , 2 , 10 , 0.66
1/5/2018, 100 , 5 , 3 , 15, 1.00
Step 3: get max(field_2-total_time) that is less than 90% of the field_3(qty) percentile calculation.
In this case for the current grouping of data, my max value should be 46 which corresponds to 'less than 90%' of field_3.
I can simply do this as a formula in sql before creating the json file, but I am looking to have this formula as a scripted field in Kibana so that I can make the aggregations at different levels based on date field (Day, week, month, quarter or yearly). I do not want to create separate columns for all the different levels of aggregations that I want to see.
Thanks,
Dinesh