# 2nd Level Nested aggregation incorrect doc\_count

**URL:** https://discuss.elastic.co/t/2nd-level-nested-aggregation-incorrect-doc-count/298515
**Category:** Elasticsearch
**Created:** [March 1, 2022, 1:38pm UTC](https://discuss.elastic.co/t/2nd-level-nested-aggregation-incorrect-doc-count/298515 "2022-03-01T13:38:16Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Adam\_Whittaker](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/adam_whittaker/32/75325_2.png) [@Adam\_Whittaker](https://discuss.elastic.co/u/Adam_Whittaker)
#### Post date: [March 1, 2022, 1:38pm UTC](https://discuss.elastic.co/t/2nd-level-nested-aggregation-incorrect-doc-count/298515/1 "2022-03-01T13:38:16Z")

</div>

Hello,

Can anyone point me to why the doc\_count on my 2nd nested aggregation is not correct?  
The count on the first aggregation is accurate but the 2nd isnt.

```auto
{
  "size": 0,
  "_source": false,
  "query": {
    "match_all": {}
  },
  "aggs": {
    "products": {
      "nested": {
        "path": "productsImpacted"
      },
      "aggs": {
        "field1": {
          "terms": {
            "field": "productsImpacted.product.keyword",
            "size": 1000
          },
            "aggs": {
              "resellers": {
                "nested": {
                  "path": "requestType"
                },
                "aggs": {
                  "field2": {
                    "terms": {
                      "field": "requestType.type.keyword",
                      "size": 1000
                    }
                  }
                }
              }
            }
        }
      }
    }
  }
}

```

ElasticVersion: 7.10.1

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: [March 29, 2022, 1:39pm UTC](https://discuss.elastic.co/t/2nd-level-nested-aggregation-incorrect-doc-count/298515/2 "2022-03-29T13:39:14Z")

</div>

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