/** * Rewrites the given aggregation into its primitive form. Aggregations that for instance fetch resources from remote hosts or * can simplify / optimize itself should do their heavy lifting during {@link #rewrite(QueryRewriteContext)}. This method * rewrites the aggregation until it doesn't change anymore. * @throws IOException if an {@link IOException} occurs */ static AggregationBuilder rewriteAggregation(AggregationBuilder original, QueryRewriteContext context) throws IOException { AggregationBuilder builder = original; for (AggregationBuilder rewrittenBuilder = builder.rewrite(context); rewrittenBuilder != builder; rewrittenBuilder = builder.rewrite(context)) { builder = rewrittenBuilder; } return builder; }
/** * Rewrites the given aggregation into its primitive form. Aggregations that for instance fetch resources from remote hosts or * can simplify / optimize itself should do their heavy lifting during {@link #rewrite(QueryRewriteContext)}. This method * rewrites the aggregation until it doesn't change anymore. * @throws IOException if an {@link IOException} occurs */ static AggregationBuilder rewriteAggregation(AggregationBuilder original, QueryRewriteContext context) throws IOException { AggregationBuilder builder = original; for (AggregationBuilder rewrittenBuilder = builder.rewrite(context); rewrittenBuilder != builder; rewrittenBuilder = builder.rewrite(context)) { builder = rewrittenBuilder; } return builder; }
/** * Rewrites the given aggregation into its primitive form. Aggregations that for instance fetch resources from remote hosts or * can simplify / optimize itself should do their heavy lifting during {@link #rewrite(QueryRewriteContext)}. This method * rewrites the aggregation until it doesn't change anymore. * @throws IOException if an {@link IOException} occurs */ static AggregationBuilder rewriteAggregation(AggregationBuilder original, QueryRewriteContext context) throws IOException { AggregationBuilder builder = original; for (AggregationBuilder rewrittenBuilder = builder.rewrite(context); rewrittenBuilder != builder; rewrittenBuilder = builder.rewrite(context)) { builder = rewrittenBuilder; } return builder; }