# Understanding doc\_count\_error\_upper\_bound

**URL:** https://discuss.elastic.co/t/understanding-doc-count-error-upper-bound/117877
**Category:** Elasticsearch
**Created:** [January 31, 2018, 7:09pm UTC](https://discuss.elastic.co/t/understanding-doc-count-error-upper-bound/117877 "2018-01-31T19:09:23Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![javadevmtl](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/javadevmtl/32/45613_2.png) [@javadevmtl](https://discuss.elastic.co/u/javadevmtl)
#### Post date: [January 31, 2018, 7:09pm UTC](https://discuss.elastic.co/t/understanding-doc-count-error-upper-bound/117877/1 "2018-01-31T19:09:24Z")

</div>

So I read the docs but still a bit confused, or it's just not clicking....

If I use `size: 512` I get `doc_count_error_upper_bound: 45` and `sum_other_doc_count: 29728`  
If I use `size: 8192` (YES I know I should NOT use large numbers, just testing) I get `doc_count_error_upper_bound: 0` and `sum_other_doc_count: 0` which gives me an exact key count of 9.

So...

Does the result below with `size: 512` mean,

- that it has found 3 actual duplicates.
- 29728 where NOT used to find the 3 duplicates?
- 45 out of the total 75833 are potentially duplicates?

Request:

```
POST xxxxxx-2018.*/_search
{
  "query": {
    "bool": {
      "must": [
        {
          "match": {
            "message": "lookup"
          }
        }
      ],
      "must_not": []
    }
  },
  "size": 0,
  "aggs": {
    "duplicateNames": {
      "terms": {
        "field": "utid.keyword",
        "min_doc_count": 2,
        "size": 512,
         "show_term_doc_count_error": false
      }
    }
  }
}

```

Response:

```
{
  "took": 128,
  "timed_out": false,
  "_shards": {
    "total": 155,
    "successful": 155,
    "skipped": 0,
    "failed": 0
  },
  "hits": {
    "total": 75833,
    "max_score": 0,
    "hits": []
  },
  "aggregations": {
    "duplicateNames": {
      "doc_count_error_upper_bound": 45,
      "sum_other_doc_count": 29728,
      "buckets": [
        {
          "key": "0d6d614c-e515-4449-9947-f662646c32f7",
          "doc_count": 2
        },
        {
          "key": "32465f7c-4f15-4012-a285-e3f6ad890882",
          "doc_count": 2
        },
        {
          "key": "f6d874a9-cfa9-4907-99ee-00215de0136f",
          "doc_count": 2
        }
      ]
    }
  }
}
```

---

<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 28, 2018, 7:09pm UTC](https://discuss.elastic.co/t/understanding-doc-count-error-upper-bound/117877/2 "2018-02-28T19:09:43Z")

</div>

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