示例#1
0
 /**
  * Constructs a new Aggregator.
  *
  * @param name The name of the aggregation
  * @param bucketAggregationMode The nature of execution as a sub-aggregator (see {@link
  *     BucketAggregationMode})
  * @param factories The factories for all the sub-aggregators under this aggregator
  * @param estimatedBucketsCount When served as a sub-aggregator, indicate how many buckets the
  *     parent aggregator will generate.
  * @param context The aggregation context
  * @param parent The parent aggregator (may be {@code null} for top level aggregators)
  */
 protected Aggregator(
     String name,
     BucketAggregationMode bucketAggregationMode,
     AggregatorFactories factories,
     long estimatedBucketsCount,
     AggregationContext context,
     Aggregator parent) {
   this.name = name;
   this.parent = parent;
   this.estimatedBucketCount = estimatedBucketsCount;
   this.context = context;
   this.bigArrays = context.bigArrays();
   this.depth = parent == null ? 0 : 1 + parent.depth();
   this.bucketAggregationMode = bucketAggregationMode;
   assert factories != null
       : "sub-factories provided to BucketAggregator must not be null, use AggragatorFactories.EMPTY instead";
   this.factories = factories;
   this.subAggregators = factories.createSubAggregators(this, estimatedBucketsCount);
   collectableSugAggregators =
       BucketCollector.wrap(
           Iterables.filter(Arrays.asList(subAggregators), COLLECTABLE_AGGREGATOR));
   context.searchContext().addReleasable(this, Lifetime.PHASE);
 }
示例#2
0
 /** Called after collection of all document is done. */
 public final void postCollection() throws IOException {
   collectableSugAggregators.postCollection();
   doPostCollection();
 }