# Agggreation is not working for nested objects

**URL:** <https://discuss.elastic.co/t/agggreation-is-not-working-for-nested-objects/369253>\
**Category:** Elasticsearch\
**Created:** [October 23, 2024, 2:18am UTC](https://discuss.elastic.co/t/agggreation-is-not-working-for-nested-objects/369253 "2024-10-23T02:18:43Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![krishna\_kishore](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/krishna_kishore/32/138605_2.png) [@krishna\_kishore](https://discuss.elastic.co/u/krishna_kishore)\
**Post date:** [October 23, 2024, 2:18am UTC](https://discuss.elastic.co/t/agggreation-is-not-working-for-nested-objects/369253/1 "2024-10-23T02:18:43Z")

</div>

```auto
@discobot could you help me . Getting aggregations for all except attributes.

{
    "min_score": 0.5,
    "size": 500,
    "_source": true,
    "query": {
        "bool": {
            "must": [
                {
                    "multi_match": {
                        "query": "Nivi",
                        "type": "best_fields",
                        "tie_breaker": 0.3,
                        "minimum_should_match": "100%",
                        "fields": [
                            "_doc_id^2",
                            "_doc_name",
                            "autocomplete_all",
                            "descrip1",
                            "descrip2",
                            "descrip3",
                            "lookup_all",
                            "token_all"
                        ]
                    }
                }
            ],
            "filter": [
                {
                    "bool": {
                        "must": [
                            {
                                "match": {
                                    "tenant_id": "DEFAULT"
                                }
                            },
                            {
                                "terms": {
                                    "cono": [
                                        5000,
                                        0
                                    ]
                                }
                            },
                            {
                                "terms": {
                                    "record_type": [
                                        "icsp"
                                    ]
                                }
                            }
                        ]
                    }
                }
            ],
            "must_not": [
                {
                    "nested": {
                        "path": "filters",
                        "query": {
                            "bool": {
                                "should": [
                                    {
                                        "match": {
                                            "filters.activefl": false
                                        }
                                    }
                                ]
                            }
                        }
                    }
                },
                {
                    "nested": {
                        "path": "filters",
                        "query": {
                            "bool": {
                                "should": [
                                    {
                                        "match": {
                                            "filters.statustype": "i"
                                        }
                                    }
                                ]
                            }
                        }
                    }
                }
            ]
        }
    },
    "aggs": {
        "filters": {
            "nested": {
                "path": "filters"
            },
            "aggs": {
                "activefl": {
                    "terms": {
                        "field": "filters.activefl",
                        "size": 200
                    }
                },
                "apsvRowpointer": {
                    "terms": {
                        "field": "filters.apsvRowpointer",
                        "size": 200
                    }
                },
                "arscRowpointer": {
                    "terms": {
                        "field": "filters.arscRowpointer",
                        "size": 200
                    }
                },
                "arssRowpointer": {
                    "terms": {
                        "field": "filters.arssRowpointer",
                        "size": 200
                    }
                },
                "brandcode": {
                    "terms": {
                        "field": "filters.brandcode",
                        "size": 200
                    }
                },
                "countryoforigin": {
                    "terms": {
                        "field": "filters.countryoforigin",
                        "size": 200
                    }
                },
                "attributeGroup": {
                    "terms": {
                        "field": "filters.attributeGroup",
                        "size": 200
                    }
                },
                "icsdRowpointer": {
                    "terms": {
                        "field": "filters.icsdRowpointer",
                        "size": 200
                    }
                },
                "keyno": {
                    "terms": {
                        "field": "filters.keyno",
                        "size": 200
                    }
                },
                "kittype": {
                    "terms": {
                        "field": "filters.kittype",
                        "size": 200
                    }
                },
                "msdsfl": {
                    "terms": {
                        "field": "filters.msdsfl",
                        "size": 200
                    }
                },
                "nonstockty": {
                    "terms": {
                        "field": "filters.nonstockty",
                        "size": 200
                    }
                },
                "pricetype": {
                    "terms": {
                        "field": "filters.pricetype",
                        "size": 200
                    }
                },
                "prodcat": {
                    "terms": {
                        "field": "filters.prodcat",
                        "size": 200
                    }
                },
                "prodline": {
                    "terms": {
                        "field": "filters.prodline",
                        "size": 200
                    }
                },
                "prodtiergrp": {
                    "terms": {
                        "field": "filters.prodtiergrp",
                        "size": 200
                    }
                },
                "qtyavailAgg": {
                    "terms": {
                        "field": "filters.qtyavailAgg",
                        "size": 200
                    }
                },
                "rectype": {
                    "terms": {
                        "field": "filters.rectype",
                        "size": 200
                    }
                },
                "statustype": {
                    "terms": {
                        "field": "filters.statustype",
                        "size": 200
                    }
                },
                "unitbuy": {
                    "terms": {
                        "field": "filters.unitbuy",
                        "size": 200
                    }
                },
                "unitstock": {
                    "terms": {
                        "field": "filters.unitstock",
                        "size": 200
                    }
                },
                "attributes": {
                    "nested": {
                        "path": "filters.attributes"
                    },
                    "aggs": {
                        "attribute_value": {
                            "terms": {
                                "field": "filters.attributes.attribute_value",
                                "size": 200
                            }
                        }
                    }
                }
            }
        }
    }
}`Preformatted text`

```

```auto
type or paste code here

```
