Sorting in Ruby Client Query

Hi -
I'
I wanted to sort the System CPU% from the Ascending order along with the @timestamp. I had the below query which provides the Max CPU load. Would you please let me know how do I get the all the values with sorted order.

I'd like to get the delta time between the cpu load peaks. Please help.

{
"size": 0,
"aggs": {
"1": {
"max": {
"field": "system.cpu.system.pct"
}
}
},
"query": {
"bool": {
"must": [
{
"query_string": {
"query": "metricset.module: system AND metricset.name: cpu"
}
},
{
"match": {
"beat.name": {
"query": "AAEINBLR03199L"
}
}
}
]
}
}
}

Hey,

please take your time and format your messages properly using markdown, especially code snippets, so others can read your message more easily.

Also, you may want to check out the documentation about sorting: https://www.elastic.co/guide/en/elasticsearch/reference/5.2/search-request-sort.html

If you want to sort your aggregation results, you maybe want to check out sorting in aggregations (in this example for the terms agg) https://www.elastic.co/guide/en/elasticsearch/reference/5.2/search-aggregations-bucket-terms-aggregation.html#search-aggregations-bucket-terms-aggregation-order

--Alex

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