Hi-
Am trying to get the Maximum aggregated value for a specific process using Ruby Client. Here is the query I created:
def get_process_cpu(hostname)
begin
res = @client.search index: 'metricbeat-*', body:
{
"size": 0,
"aggs": {
"1": {
"max": {
"field": "system.process.cpu.total.pct"
}
}
},
"query": {
"bool": {
"must": [
{
"query_string": {
"query": "metricset.name: process",
}
},
{
"match": {
"beat.name": {
"query": "#{hostname}",
"type": "phrase"
}
}
},
{
"match": {
"system.process.name": {
"query": "metricbeat.exe",
"type": "phrase"
}
}
}
]
}
}
}
But, I think am getting the max percentage among all the processes not specific to metricbeat.exe... Could some one please have a look into the query and let me know if any thing wrong. Thanks !