Composite aggregation behavior when missing a key, not value

Hi every body!
I'm using composite aggregation to multi terms on my data.
some where in docs elastic says:

By default documents without a value for a given source are ignored. It is possible to include them in the response by setting missing_bucket to true

I have a question! what is the behavior of this aggregation when a key is missing?

for example my data is :

{
car: "toyota",
color: "white",
cost: 3
},
{
car: "toyota",
cost: 5
},
{
car: "benz",
color: "white",
cost: 6
},
{
"car": "honda"
}

what is the output of the above when i use:

{
            "size": 0, 
            "query": {
                "match_all": {
                }
            },
            "aggs": {
                "group_by": {
                "composite": {
                    "size": 65535, 
                    "sources": [
                    {
                        "car": {
                        "terms": {
                            "field": "car",
                            "missing_bucket": true
                        }
                        }
                    },
                    {
                        "color": {
                        "terms": {
                            "field": "color",
                            "missing_bucket": true
                        }
                        }
                    }
                    ]
                }},
                "aggs": {
                    "cost": {
                    "sum": {
                        "field": "cost"
                    }
                }
                }
            }
        }

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