SetAggregation in Java Client Builder Not Available in 5.x


(Jack Vinijtrongjit) #1

Is setAggregation method permanently removed? I used to be able to use JSON constructed outside and then pass it in, but now I have to parse it and recreate again using AggregationBuilders. Is there a plan to have something similar to wrapQuery method in QueryBuilder?


(system) #2

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.


(Luca Cavanna) #3

Hi Jack,
this changed once we moved search request parsing to the coordinating node. When you send a request through the rest layer, it gets parsed into a SearchRequest (the same object that the Java client uses) and sent around using the transport layer from then on. If you are using the java api you are one step ahead, meaning that you provide the SearchRequest object already, hence no parsing will be performed. WrapperQueryBuilder is an exception for queries, as it allows to delay parsing and provide json while creating a query to be sent through java api. We don't plan on doing the same for aggregations. In general, I would say that it's better to create the aggregations directly using the java API objects rather than json.

Cheers
Luca