JAVA API not found for top_metric aggregation

I am using elastic search 7.11.1 and going to use top_metric aggregation to get the top records under the terms aggregation bucket. And my query is something like the following:

{
"size": 0,
"query": {
"bool": {
"must": [
{
"terms": {
"type": [
"data_type"
]
}
}
]
}
},
"aggregations": {
"field1": {
"terms": {
"field": "field1",
"size": 10
},
"aggregations": {
"field2": {
"terms": {
"field": "field2",
"size": 10
},
"aggregations": {
"field3": {
"terms": {
"field": "field3",
"size": 10
},
"aggregations": {
"amount": {
"extended_stats": {
"field": "amount"
}
},
"hits_here": {
"top_metrics": {
"metrics": [
{
"field": "field3"
},
{
"field": "field4"
},
{
"field": "field5"
}
],
"sort": "_score"
}
}
}
}
}
}
}
}
},
"track_total_hits": 2147483647
}

This query yields the expected results from ES, and now I would like to use this via JAVA API but I'm unable to find its related JAVA class in both ES 7.11 and 7.14, am I missing anything here or is it actually not available in API? If not available in API, is there any options to use the similar functionality?

Have you seen the TopMetricAggregationBuilder?

Thank you for pointing this out. It worked.

Is there a chance that Top Metric Aggregation support will be added to Java Transport Client API?

Not sure I understand the question. The transport client is not intended for client-to-cluster communication, so this is only available in the REST client.