Hi, I have the following document
fieldA: String,
fieldB: boolean,
fieldC: String,
fieldD: String,
fieldE: String
I using composite aggregation and sub-aggregations. I want to sort the composite buckets contain all the items that have fieldB set to true (in this case min_agg returns 1) and then on fieldC by name
GET _search
{
"aggregations": {
"agg": {
"aggregations": {
"min_agg": {
"min": {
"field": "fieldB"
}
},
"term_agg": {
"terms": {
"field": "fieldC.keyword"
}
},
"info": {
"top_hits": {
"size": 1,
"_source": {
"includes": [
"fieldB",
"fieldC",
"fieldD"
]
}
}
}
},
"composite": {
"sources": [
{
"fieldA": {
"terms": {
"field": "fieldA.keyword"
}
}
}
]
}
}
},
"size": 0
}