How can i get exact the number of item in array?

How can i count exact the number of item in array object?

I have data like below.

doc1
people :
[
{email:a@virtual.com},
{email:b@virtual.com},
{email:c@another.com}
]

doc2
people :
[
{email:d@virtual.com},
{email:e@virtual.com},
{email:f@another.com}
]

I want to count the unique number of *@another.com, in the documents.

So i did in kibana like below:

visualize ->
make data table ->
In metric 'Unique Count' and select 'people' metric ->
In bucket, select 'filter' aggregation ->
wrote people.email : "*.another.com"

In result, it shows 6.
But i want value 2 (c@another.com and f@another.com)

In this case, how can i get exact the number of item in array.

Kibana is not able to aggregate on nested types such as the arrays in your documents. https://www.elastic.co/guide/en/kibana/current/nested-objects.html

We have an issue to track this feature request here. https://github.com/elastic/kibana/issues/1084

Thank you :slight_smile:

1 Like