Describe the issue:
Attempting to move to the java client libraries using the various builders, and I am not understanding the use of the nested query builder. In pure JSON, my query looks in part something like this, to sum fields in a nested document:
“aggs”: {
“root”: {
“nested”: {
“path”: “orders”
},
“aggs”: {
“cat”: {
“terms”: {
“field”: “orders.category”
},
“aggs”: {
“orders.quantity”: {
“sum”: {
“field”: “orders.qty”
}
…
This works. Trying to move to AggregationBuilders, in particular
AggregationBuilders.nested()
but it does not appear to have any designation for child aggregations, only name and path. Is there another way to create these sorts of aggregations?