Need help with aggregation query

Hi All,

I am trying to write a query to get host and max cpu usage from metric beat data but i was not able to write exact query to get max cpu along with host name. for example below is the data

        "hostname:"host1","cpu_pct":"20"
        "hostname:"host1","cpu_pct":"10"

    "hostname:"host2","cpu_pct":"13"
    "hostname:"host2","cpu_pct":"17"

By using term aggregations i am able to get the unique host names but am looking unique host names along with max cpu usage like below

"hostname":"host1" 
"cpu_pct":"20"

"hostname":"host2",
"cpu_pct":"17"

Could some one help me how we can use term and max aggregations together

Thanks

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