In the new Elasticsearch Java Client API, the method build() of class co.elastic.clients.Elasticsearch._types.aggregations.Aggregation.Builder is not public. What is the correct way of creating an instance of co.elastic.clients.Elasticsearch._types.aggregations.Aggregation without using the Builder class ?
Thanks for your help,
I found the anwser, that is quite simple: as building an instance of Aggregation itself doesn't make any sense, the build() method of Aggregation.Builder is not public. But that does not prevent me from creating an actual aggregation, for example:
Aggregation add = new Aggregation.Builder()
Your analysis is exactly right: an aggregation is just a wrapper object that contains the variant kind and the value. So its builder only contains methods to set a variant. And the result of these methods is an
ObjectBuilder on which you can call
build() to create the final object.