I created the query below and I want to execute it with the Java Client provided but I can't really find a way.
GET asset-records-latest/_search
{
"size": 0,
"aggs": {
"agg1": {
"terms": {
"field": "asset_id",
"order": {
"agg2": "desc"
},
"size": 10
},
"aggs": {
"agg2": {
"max": {
"field": "risk_index_value"
}
}
}
}
}
}