Elastic Search Aggregation with bool query

This is my elastic bool query. this works fine :

{
  "query": {
        "bool": {
            "filter": [
                {
                    "terms": {
                        "parent_uuid._raw": [
                            "87ec596a-109e-45ce-8a8d-7a2d1a56df81",
                            "07526608-8140-46be-96b9-c5f7cca4bd93"
                        ]
                    }
                },
                {
                    "terms": {
                        "resource_type._raw": [
                            "Zone"
                        ]
                    }
                }
            ]
        }
    },
    "from": 0
}

I want aggregation on name field. So I add this :

"aggs": {
    "group_by_name": {
        "terms": {
            "field": "display_name.keyword"
        }
    } }

But result is same. What I am missing?

@Vaibhav_Sharma,
Can you elaborate "But result is same" ?

If you include query and aggs, you will get 10 results matching your query like basic bool query, but there will be a section in the results for the aggregated value too.

If you only want aggregated value, add "size" : 0 in the query to suppress hits.

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