How to implement nested aggregations using java client

Versions
opensearch-rest-client: 2.4.0
opensearch-java: 2.1.0

Describe the issue:
I just want to know how I can implement a nested aggregation to add it to a search query using the opensearch-java client classes. Below there is an example of what I want to do:

{
  "aggs": {
    "2": {
      "terms": {
        "field": "bytes",
        "order": {
          "_count": "desc"
        },
        "size": 5
      },
      "aggs": {
        "3": {
          "terms": {
            "field": "machine.ram",
            "order": {
              "_count": "desc"
            },
            "size": 5
          }
        }
      }
    }
  }

I just want to someone explain the way to translate the request above to the opensearch java client way.

Hi @leonardo89
Have you figured this out yet? If so, please post your solution here for future reference. And if not, hopefully someone can comment on this.

@leonardo89 @wbeckler the opensearch-java client tests have a large number of examples of nested aggregations, fe [1], [2], hope it helps. Thank you.

[1] opensearch-java/ApiConventionsTest.java at main · opensearch-project/opensearch-java · GitHub
[2] opensearch-java/RequestTest.java at main · opensearch-project/opensearch-java · GitHub

Here are the solution posted by rabbitbr in Stackoverflow:
elasticsearch - How to implement nested aggregations using opensearch java client - Stack Overflow