We were using the Rest High Level Client before and below was the usage to access the aggregation buckets from the SearchResponse
ParsedStringTerms aggregation1 = searchResponse.getAggregations().get(AGGREGATION1.name);
for (Terms.Bucket bucket : aggregation1.getBuckets()) {
for (Aggregation aggregation2 : bucket.getAggregations()) {
List<? extends Terms.Bucket> buckets = ((ParsedStringTerms) aggregation2).getBuckets();
// do something with the subaggregations
}
}
How do we go about accessing it in the new version of Java Client API ?
I do see these mention to use _custom to access these buckets ? Is there any other way to access these buckets ?