"aggs": {
    "2": {
      "terms": {
        "field": "dns.question.type",
        "size": 1000,
        "order": {
          "_count": "desc"
        }
I do not understand how to add an aggregation to the Java API elasticsearch request. It is necessary to count the number of documents with the value dns.question.type and return them
 SearchResponse response = client.prepareSearch(String.valueOf(QueryBuilders.rangeQuery("@timestamp").gte("now-11d").lt("now-9d")).addAggregation(
AggregationBuilders.terms("")
And how do I withdraw after the value of the response such as a Hash Map