|
@@ -133,22 +133,18 @@ public class AggregationPhase implements SearchPhase {
|
|
|
}
|
|
|
}
|
|
|
context.queryResult().aggregations(new InternalAggregations(aggregations));
|
|
|
- try {
|
|
|
- List<PipelineAggregator> pipelineAggregators = context.aggregations().factories().createPipelineAggregators();
|
|
|
- List<SiblingPipelineAggregator> siblingPipelineAggregators = new ArrayList<>(pipelineAggregators.size());
|
|
|
- for (PipelineAggregator pipelineAggregator : pipelineAggregators) {
|
|
|
- if (pipelineAggregator instanceof SiblingPipelineAggregator) {
|
|
|
- siblingPipelineAggregators.add((SiblingPipelineAggregator) pipelineAggregator);
|
|
|
- } else {
|
|
|
- throw new AggregationExecutionException("Invalid pipeline aggregation named [" + pipelineAggregator.name()
|
|
|
- + "] of type [" + pipelineAggregator.getWriteableName() + "]. Only sibling pipeline aggregations are "
|
|
|
- + "allowed at the top level");
|
|
|
- }
|
|
|
+ List<PipelineAggregator> pipelineAggregators = context.aggregations().factories().createPipelineAggregators();
|
|
|
+ List<SiblingPipelineAggregator> siblingPipelineAggregators = new ArrayList<>(pipelineAggregators.size());
|
|
|
+ for (PipelineAggregator pipelineAggregator : pipelineAggregators) {
|
|
|
+ if (pipelineAggregator instanceof SiblingPipelineAggregator) {
|
|
|
+ siblingPipelineAggregators.add((SiblingPipelineAggregator) pipelineAggregator);
|
|
|
+ } else {
|
|
|
+ throw new AggregationExecutionException("Invalid pipeline aggregation named [" + pipelineAggregator.name()
|
|
|
+ + "] of type [" + pipelineAggregator.getWriteableName() + "]. Only sibling pipeline aggregations are "
|
|
|
+ + "allowed at the top level");
|
|
|
}
|
|
|
- context.queryResult().pipelineAggregators(siblingPipelineAggregators);
|
|
|
- } catch (IOException e) {
|
|
|
- throw new AggregationExecutionException("Failed to build top level pipeline aggregators", e);
|
|
|
}
|
|
|
+ context.queryResult().pipelineAggregators(siblingPipelineAggregators);
|
|
|
|
|
|
// disable aggregations so that they don't run on next pages in case of scrolling
|
|
|
context.aggregations(null);
|