Hi,
I am trying to perform simple difference between the values in two aggregations but unable to do so...
Kibana Query
{
"_source": false,
"query": {
"range": {
"timestamp": {
"gte": "now-90m/m",
"lte": "now"
}
}
},
"aggs": {
"baselineCmtsCount": {
"cardinality": {
"field": "cmtsId"
}
},
"every45min": {
"date_histogram": {
"field": "timestamp",
"fixed_interval": "45m",
"order": {
"_key": "asc"
}
},
"aggs": {
"cmtsPer45min": {
"cardinality": {
"field": "cmtsId"
}
}
}
},
"cmtsDerivative": {
"bucket_script": {
"buckets_path": {
"var1": "baselineCmtsCount.value",
"var2": "every45min.buckets.1.cmtsPer45min.value"
},
"script": "params.var1 - params.var2"
}
}
}
}
Is bucket_script correct or what is wrong ? Please help