Count of values on array field on visualization

Hello.
I have the next field

"purchasePlanRowItem_okei_code": [
"168",
"168",
"168",
"168",
"168",
"168",
"876"
],

This is array.
When I create pie chart visualization, I turn Split Slices, Aggregation - Terms, Field - purchasePlanRowItem_okei_code. And turn Slice Size, Aggregation - Count.

As result, I view chart divided into two parts. The first part is called the 168, the second part is called the 876. However, the first part of the Count is equal to one, the second part of the County is equal to one. Those, all Count is two. But my field contains array with seven values, but no two. I want to get a chart: The first part is called 168 and it Count is six, the second part is called the 876, and it is equal to one Count.

How I can do it?

Can anybody help me?

Asking for count on a metric aggregation will give you the number of documents in each bucket of the terms aggregation. To get counts on the contents of your field in an individual document isn't possible without breaking the field up more, or without https://github.com/elastic/kibana/issues/2646.

What do you want your final visualization to look like? Sums of nested numbers in purchasePlanRowItem_okei_code across all documents?

1 Like

Yes, and it is also

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