Trying to use the opensearch-java client to perform aggregations on nested documents. We have an index of projects, and each document has a nested palette document, and we want to count all the primary color choices, in order to get an idea of how popular each one is on each project. The json of a successful query looks something like this
"aggs": {
"group_by_project": {
"terms": {
"field": "project_code"
},
"aggs": {
"primary_color": {
"nested": {
"path": "palette"
},
"aggs": {
"primary_color_palette": {
"terms": {
"field": "palette.primary"
},
"aggs": {
"warm": {
"sum": {
"field": "warm"
}
},
...
}
}
}
}
...
the NestedAggregation.Builder class does not seem to have methods other than name and field -- what is the proper way to construct nested aggregations in the opensearch-java client