Lower precision_threshold in cardinality takes more time than higher

I'm using cardinality aggregation as a sub aggregation inside a term aggregation.
I read a lot of explanations from Elasticsearch that says the higher the precision_threshold the more time the query takes. but I see the exact opposite. if I send query with precision_threshold 100 the query takes more than 28 sec, but if I send the exact same query with precision_threshold 500 the query takes 4 sec
this is the query I'm sending:

{"aggregations": {"sourceGrid": {"aggregations": { "bucket_sort": {"bucket_sort": {"from": 0,"size": 100}},"attributeCount": {"cardinality": {"field": "attribute.keywordWithoutLowercaseNormalizer", "precision_threshold": 100}}},"terms": {"field": "source.keywordWithoutLowercaseNormalizer", "size": 100}}},"size": 0}

I don't understand why is this happening, what number of precision_threshold is the best for the best performance?

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