I'm doing an aggregation on devices and calculating a metric on each. Is there a way to include other fields for the device in that top bucket like id, city, state? Each document in the vn-aggr index has those fields in it.
{
"size": 0,
"query": {
"bool": {
"must": [
{
"range": {
"dttm": {
"gte": "now-24h",
"lte": "now"
}
}
}
]
}
},
"aggs": {
"resources": {
"terms": {
"field": "displayname.keyword",
"size": 10
},
"aggs": {
"90_inpeak": {
"percentiles": {
"field": "inpeak_util",
"percents": [
90
]
}
}
}
}
}
}
The result is:
{
"took" : 21687,
"timed_out" : false,
"_shards" : {
"total" : 1,
"successful" : 1,
"skipped" : 0,
"failed" : 0
},
"hits" : {
"total" : 17984980,
"max_score" : 0.0,
"hits" : [ ]
},
"aggregations" : {
"resources" : {
"doc_count_error_upper_bound" : 0,
"sum_other_doc_count" : 17939432,
"buckets" : [
{
"key" : "c4a24244_utp ethernet (10/100)",
"doc_count" : 378,
"90_inpeak" : {
"values" : {
"90.0" : 0.01721082963049412
}
}
},
{
"key" : "c0a24244_utp ethernet (10/100)",
"doc_count" : 360,
"90_inpeak" : {
"values" : {
"90.0" : 0.004095323150977492
}
}
},.....
Is there a way to include those identifiers in the term bucket like:
{
"key" : "c4a24244_utp ethernet (10/100)",
"resourceid" : "1234",
"city" : "Houston",
"state" : "TX",
"doc_count" : 378,
"90_inpeak" : {
"values" : {
"90.0" : 0.01721082963049412
}
}
},