Class FiltersAggregator.FilterByFilter

All Implemented Interfaces:
java.io.Closeable, java.lang.AutoCloseable, org.apache.lucene.search.Collector, Releasable
Enclosing class:
FiltersAggregator

public static class FiltersAggregator.FilterByFilter
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

    • estimateCost

      public long estimateCost​(long maxCost) throws java.io.IOException
      Estimate the number of documents that this aggregation must visit. We'll stop counting once we've passed maxEstimatedCost if we aren't profiling.
      Throws:
      java.io.IOException
    • getLeafCollector

      protected LeafBucketCollector getLeafCollector​(org.apache.lucene.index.LeafReaderContext ctx, LeafBucketCollector sub) throws java.io.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:
      java.io.IOException
    • collectDebugInfo

      public void collectDebugInfo​(java.util.function.BiConsumer<java.lang.String,​java.lang.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 Aggregator