Kibana - Visualize an array with variable number of fields in each document

I have an index pattern in my kibana with an array field. The array field contains variable number of strings in each document. I have to visualize the count of each string in all documents. I went through many articles, people recommend to use painless script in situations when we are trying to access array elements. But in my case I am unable to figure out what exactly should I do using painless because the size of array is not fixed so I can't extract array values in different variables.

Please Help me with this. Also suggest some other way of doing so apart from painless. Thanks in advance.

You could use a Painless scripted field like this:

return params._source.foo.length;

Alternatively, you could index the length of the array as a separate field and visualize on that instead.

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