# Sum\_other\_doc\_count field in aggregations?

**URL:** https://discuss.elastic.co/t/sum-other-doc-count-field-in-aggregations/82137
**Category:** Elasticsearch
**Created:** [April 12, 2017, 10:20am UTC](https://discuss.elastic.co/t/sum-other-doc-count-field-in-aggregations/82137 "2017-04-12T10:20:10Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Yaswanth](https://avatars.discourse-cdn.com/v4/letter/y/94ad74/32.png) [@Yaswanth](https://discuss.elastic.co/u/Yaswanth)
#### Post date: [April 12, 2017, 10:20am UTC](https://discuss.elastic.co/t/sum-other-doc-count-field-in-aggregations/82137/1 "2017-04-12T10:20:10Z")

</div>

HI,

I have some documents in an index . To count the number of documents in an index i am using the following command:

```
GET data/_count
{
   "count": 390,
   "_shards": {
      "total": 5,
      "successful": 5,
      "failed": 0
   }
}

```

But when i used the following command to see all the indices it is showing stats like this

```
GET _cat/indices?v
health status index pri rep docs.count docs.deleted store.size pri.store.size 
green open data 5 1 791 65 6.1mb 2.9mb 

```

Why it is showing docs count as 791?

And when i use query to find all the values for a field it is showing different results

```
GET data/_search
{
       "size":0,
    "aggs" : {
        "codes" : {
            "terms" : {
                "field" : "university.code",
                "size" : 390
            }
        }
    }
}

```

Response:

```
"aggregations": {
      "codes": {
         "doc_count_error_upper_bound": 0,
         "sum_other_doc_count": 11,
         "buckets": [
            {
               "key": 3476,
               "doc_count": 1
            }, .....

```

In that above response i am seeing `"sum_other_doc_count": 11`. It means still there are 11 doc's in the index(i.e. 390+11=401 doc's)

When i given size field in aggregations to 0 (i.e.`size:0`). then it is showing the `"sum_other_doc_count": 0`

Why this is happening?

Thanks

---

<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: [May 10, 2017, 10:34am UTC](https://discuss.elastic.co/t/sum-other-doc-count-field-in-aggregations/82137/2 "2017-05-10T10:34:01Z")

</div>

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