# Accurate count of distinct values

**URL:** <https://discuss.elastic.co/t/accurate-count-of-distinct-values/217188>\
**Category:** Elasticsearch\
**Created:** [January 30, 2020, 12:57pm UTC](https://discuss.elastic.co/t/accurate-count-of-distinct-values/217188 "2020-01-30T12:57:54Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kobi\_Atun](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kobi_atun/32/61733_2.png) [@Kobi\_Atun](https://discuss.elastic.co/u/Kobi_Atun)\
**Post date:** [January 30, 2020, 12:57pm UTC](https://discuss.elastic.co/t/accurate-count-of-distinct-values/217188/1 "2020-01-30T12:57:54Z")

</div>

Hello,

I'm using elastic search in order to store information about search terms.  
My document structure:

- site
- search term
- date (year and month)
- data1
- data2

I have an index for each month.

For a given query with site and search term boolean search (substrings to include\exculde),  
I want to get the number of search terms per number of words (without duplications), for example:

- 5 search terms with 1 word
- 10 search terms with 2 words.
- total search terms: 15

I'm trying to use cardinality-aggregation (with precision\_threshold = 40,000) but getting inaccurate numbers. In a single query, I may aggregate data over 360,000 search terms.  
There is a way to get accurate result in my case?

Thanks,  
Kobi

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [February 27, 2020, 12:57pm UTC](https://discuss.elastic.co/t/accurate-count-of-distinct-values/217188/2 "2020-02-27T12:57:55Z")

</div>

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