Kibana Lens - Line Type - How to show the percentage of each terms

Hi all,

I would like to create a visualization of Line type using Lens that display the percentage of each terms.

The challange here is: in some documents, I have a field of type array with different values

So, as example, each document have a field called "timestamp" and another field called "color" and the values can be:

2023-10-18 22:01:00 | pink
2023-10-18 22:02:00 | red
2023-10-18 22:03:00 | yellow, red, blue, black, yellow, yellow
2023-10-18 22:04:00 | black, red, yellow

Remembering field "color" is an array, how can I create a line visualization using Lens that display the percentage in timeline ?

I've tried to create a lens visualizantion but the percentage value is wrong and i think it is because of array field. The formula i used in "vertical axis" was:

count(kql='color : *') / overall_sum(count(kql='color : *'))

ps.: i cant upload the image

Hi @Claudio_Ract_Costa . Is there a particular color you are interested in or are you looking for one line per color?

I don't think Lens formula can be used to process array fields this way (right, @Marco_Liberati ?). You could add a runtime field to your data view that computes the percentage for a color, but you'd need to add N runtime fields for N colors.

Runtime fields are written in the Painless language.

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