Hi Chritian,
The old post you mentionned was the first i did try for my issue, i did face to some limitations with painless script inside kibana due to the amount of objects i could have to manage ( ~3millions ).
By the way, i think i am near a solution :
GET /jobs/_search
{
"size": 0,
"aggs": {
"server": {
"terms": {
"field": "server.keyword"
},
"aggs": {
"jobs1": { .. },
"jobs2": { .. }
}
},
"sum_total": {
"sum_bucket": {
"buckets_path": "server>jobs1>sum_alloc_cpu"
}
}
}
}
Where :
"jobsX": {
"filter": {
"bool": {
"must": [
{
"range": {
"time_start": {
"lte": 153835200X
}
}
},
{
"range": {
"time_end": {
"gte": 153835200X
}
}
}
],
}
},
"aggs": {
"sum_alloc_cpu": {
"sum": {
"field": "alloc_cpu"
}
}
}
}
I am stuck here to play with bucket_path and to give it a kind of wildcard like "server>jobs*>sum_alloc_cpu".
The response actually give is :
{
"aggregations" : {
"server" : {
"buckets" : [
{
"key" : "server1",
"jobs1" : {
"alloc_cpu" : {
"value" : 5.0
}
},
"jobs2" : {
"alloc_cpu" : {
"value" : 8.0
}
}
},
{
"key" : "server2",
"jobs1" : {
"value" : 7.0
}
},
"jobs2" : {
"alloc_cpu" : {
"value" : 3.0
}
}
},
{
"key" : "server3",
"jobs1" : {
"alloc_cpu" : {
"value" : 4.0
}
},
"jobs2" : {
"alloc_cpu" : {
"value" : 1.0
}
}
}
]
},
"sum_total" : {
"value" : 16.0
}
}
I wish to be able to have the sum of these aggregation of : jobs1, jobs2, etc ... for alloc_cpu per key "server1, server2, ... "
I would definitely prefer to script generation of aggregation from jobs1 to jobsX , but for now, how can i be able to sum aggregation metric on the way i did mention ?
Thanks in advance.
rgds
Nicolas