Elasticsearch cardinality aggregation not returning accurate numbers despite using precision_threshold

Hi folks,

I am trying to show unique count in a metric and observed that the numbers are wrong.


I ​used enhanced table visualisation and did a "unique count" of keyword type field. in advanced setting I used {"precision_threshold":20000}.

The filter used on top is of the format: field1.keyword:"value" AND field2:9*. I am getting a unique count of 13680.

However when I do terms aggregation and calculate the sum, it is showing 13678. I verified this number by downloading the csv and counting within excel.

The same issue occurs for metric type visualisation. Is there any setting which I am missing here or is this a product bug ?

Thank you

Have a look at this thread.

Hi @Christian_Dahlqvist ,

In my case its is a single index, hence the field is consistently of the type keyword.
Does it mean it is a limitation of the 1st counting technique ?


As far as I know it is always an approximation.

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