Create Rules in kibana-> unknown field [aggs]

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"
      }
    }
  }
}

}

Hi Can anyone have any idea? How to set such rule?

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.