Scripted fields to calculate %

Hi,
I have a field in Kibana which would say if my ticket is passed or failed.

has_passed is the field.
I wanna write a scripted_field based on this value.

> target % = (count(has_passed='passed')/count(total)) *100

how do i do this?

Hi @katara,
unfortunately, scripted fields are property of the document and not the index. You cannot use scripted field for storing aggregated data. Example: if you have document with price and discount_price you can calculate the % of the discount, but you cannot calculate average of price in the whole index.
What might be helpful for your example is to create TSVB visualization with filter ratio. Check out the example here: https://www.elastic.co/blog/how-to-display-data-as-a-percentage-in-kibana-visualizations

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