# Composite aggregation on a nested object

**URL:** https://discuss.elastic.co/t/composite-aggregation-on-a-nested-object/124112
**Category:** Elasticsearch
**Created:** [March 15, 2018, 2:15pm UTC](https://discuss.elastic.co/t/composite-aggregation-on-a-nested-object/124112 "2018-03-15T14:15:56Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![sharongur](https://avatars.discourse-cdn.com/v4/letter/s/7993a0/32.png) [@sharongur](https://discuss.elastic.co/u/sharongur)
#### Post date: [March 15, 2018, 2:15pm UTC](https://discuss.elastic.co/t/composite-aggregation-on-a-nested-object/124112/1 "2018-03-15T14:15:56Z")

</div>

I was trying to test the composite method.

But i couldnt find documentation that i can do a composite aggregation on a nested document, is it possible?

thats the query with partitioning i want to convert to the composite one

```
#partionining
GET new_mappings/shahar_relax/_search
{
  "query": {
    "bool": {
      "must": [
        {
          "match_all": {}
        }
      ]
    }
  },
  "aggs": {
    "identifiers": {
      "nested": {
        "path": "identifiers"
      },
      "aggs": {
        "identifierType": {
          "terms": {
            "field": "identifiers.identifierType",
            "size": 10000,
            "include": {
              "partition": 0,
              "num_partitions": 10
            }
          },
          "aggs": {
            "identifierValue": {
              "terms": {
                "field": "identifiers.identifierValue",
                "size": 10000,
                "include": {
                  "partition": 0,
                  "num_partitions": 10
                }
              }
            },
            "identifierValueDistinctCount": {
              "cardinality": {
                "field": "identifiers.identifierValue",
                "precision_threshold": 40000
              }
            }
          }
        }
      }
    }
  }
}
```

---

<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: [April 12, 2018, 2:16pm UTC](https://discuss.elastic.co/t/composite-aggregation-on-a-nested-object/124112/2 "2018-04-12T14:16:00Z")

</div>

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