is there any possibility to NOT output the result of an intermediate aggregation? This seems to take a lot of time depending on the resultset.
What I want to achieve is the following: I have a mapping for items, which have a nested field for prices, as one item can have multiple (every price has a catalogid, which a user may access or not). If a user searches for items, I want to aggregate the min/max price of the set to provide a price filter.
So what I do is: Aggreate by itemid -> filter unaccessible prices -> get the lowest prices per item -> get the lowest/highest price of all aggregated min prices
AggregationBuilders.terms("groupById") .field("itemId") .size(100000) .subAggregation(AggregationBuilders.nested("nestedPrices", "prices") .subAggregation(AggregationBuilders.filter( "filteredPrices", buildCatalogFilter()) .subAggregation( AggregationBuilders .min("minPrice") .field("prices" + "." + "price"))));
new MinBucketPipelineAggregationBuilder("minPriceOfAllItems", "groupById>nestedPrices>filteredPrices>minPrice")
As a searchrequest may return more than just a few items the aggregation "groupById" can get pretty big and I don't need the intermediate result of it anyway. Is there a way to NOT output the result of such an intermediate aggregation? Or is there a better way of aggregating the needed information?
Update: as the aggregations are slow for small sizes ... is there a better way to aggregate the data?