I have a java app that makes use of the SearchRequestBuilder. Usually I perform the operation using this pseudocode:
SearchRequestBuilder sb;
AggregationBuilder agBuilder;
//omitted some boiler plate where these are instantiatehow
sb.addAggregation(agBuilder);
I have a requirement whereby the aggregations part of the query is in the form of a json string. I need to add it to the SearchRequestBuilder somehow. Is there a recommended way to do this ?
I thought I might be able to achieve it via the XContentBuilder , but I'm not sure if it's possible to add the results of this to a SearchRequestBuilder anymore, so I'm looking for suggestions. (and I was rather hoping there was a quicker way than me creating the boiler plate to work through the json and turn it into an AggregationBuilder myself)
Many thanks,
Phil