Class FilterByFilterAggregator

All Implemented Interfaces:
Closeable, AutoCloseable, org.apache.lucene.search.Collector, org.elasticsearch.core.Releasable

public class FilterByFilterAggregator extends FiltersAggregator
Collects results by running each filter against the searcher and doesn't build any LeafBucketCollectors which is generally faster than FiltersAggregator.Compatible but doesn't support when there is a parent aggregator or any child aggregators.
  • Method Details

    • getLeafCollector

      protected LeafBucketCollector getLeafCollector(org.apache.lucene.index.LeafReaderContext ctx, LeafBucketCollector sub) throws IOException
      Instead of returning a LeafBucketCollector we do the collection ourselves by running the filters directly. This is safe because we only use this aggregator if there isn't a parent which would change how we collect buckets and because we take the top level query into account when building the filters.
      Specified by:
      getLeafCollector in class AggregatorBase
      Throws:
      IOException
    • collectDebugInfo

      public void collectDebugInfo(BiConsumer<String,Object> add)
      Description copied from class: Aggregator
      Collect debug information to add to the profiling results. This will only be called if the aggregation is being profiled.

      Well behaved implementations will always call the superclass implementation just in case it has something interesting. They will also only add objects which can be serialized with StreamOutput.writeGenericValue(Object) and XContentBuilder.value(Object). And they'll have an integration test.

      Overrides:
      collectDebugInfo in class FiltersAggregator