I have a type called vehicle and it has this fields attributes.brand.value and attributes.brand.id I will like to create a bucket for attributes.brand. ID and VALUE will always match because they come from our database.
The only way I can think of this is creating nested buckets, like this
"aggs": {
"years": {
"terms": {
"field": "attributes.brand.value.raw",
"size": 0,
"order": {
"_term": "DESC"
}
},
"aggs": {
"id": {
"terms": {
"field": "attributes.brand.id",
"size": 0
}
}
}
}
}
In my tests this seemed expensive in CPU and RAM.