Hi
I need to create some rules in kibana over aggregation function
but I don't understand what's wrong I got "Error testing query: EsError: [1:118] unknown field [aggs]"
{
"query":{
"aggs": {
"last_values": {
"terms": {
"field": "RPTDATETIME",
"size": 1,
"order": {
"_key": "desc"
}
},
"aggs": {
"last_a_value": {
"max": {
"field": "ECCNGLV1"
}
},
"last_b_value": {
"max": {
"field": "ECCNGLV2"
}
},
"last_c_value": {
"max": {
"field": "ECCNGLV3"
}
}
}
}
},
"script_fields": {
"sum_of_last_values": {
"script": {
"source": "params['_source']['last_a_value'] + params['_source']['last_b_value'] + params['_source']['last_c_value']",
"lang": "painless"
}
}
}
}
}