I have such an aggregation query in the old High Rest Client and want to convert it into the same query in the new Java API Client but there is not sort function in the terms query. How can we convert it? Or is it by default integrated?
"aggregations": {
"DOC_TYPE": {
"filter": {
"bool": {
"adjust_pure_negative": true,
"boost": 1
}
},
"aggregations": {
"DOC_TYPE": {
"terms": {
"field": "doc_type",
"size": 50,
"min_doc_count": 1,
"shard_min_doc_count": 0,
"show_term_doc_count_error": false,
"order": [
{
"_count": "desc"
},
{
"_key": "asc"
}
]
}
}
}
}
}