Usage of Array in a Kibana Data Table : issue with Count behaving as a Unique Count

Hi,

A am facing an issue when trying to visualise data coming from an array.
For instance, my array 'Tableau_test' contains ths below

PUT /discuss_test3/_doc/1
{
"Tableau_test":[
"Moto",
"Voiture",
"Voiture",
"Velo",
"Velo",
"Velo",
"Marche",
"Marche",
"Marche",
"Marche"]
}

I am expecting to see the below in a Kibana Data Table :slight_smile:
Marche 4
Velo 3
Voiture 2
Moto 1

But the 'count' metrics seems to behave as a 'Unique count' metrics...

cf. below

If someone can explain/help
Thanks !
David

Try Sum instead count

Thanks. Already tried ; failing with "The index pattern discuss_test3 does not contain any of the following compatible field types: number" error

What you showed in your example is a single document with an array field, which gets to the core of how Lucene (which is underneath Elasticsearch) represents data.

This visualizations is showing the right thing- it shows that there is a single document that contains each value.

The "cardinality" aggregation is based on unique documents, so to get the behavior you were expecting, I would recommend indexing more than one document.

Thanks Wylie, it helps a bit.
I tried to change my data source ;
my data source is now:
PUT /discuss_test4/_doc/1
{
"Tableau_test":[
{ "mode":"Moto", "nombre" : 1},
{ "mode":"Voiture", "nombre" : 2},
{ "mode":"Vélo", "nombre" : 3},
{ "mode":"Marche", "nombre" : 4}
]
}

But I am still failing to get a visualisation in Kibana showing the below:
Marche 4
Velo 3
Voiture 2
Moto 1

Cheers

Yes, nested objects are even less supported in Elastic and Kibana. Using multiple documents is your best bet.

Yeah. Thanks. We will do so.
Cheers

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