diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/LeafBucketCollector.java b/server/src/main/java/org/elasticsearch/search/aggregations/LeafBucketCollector.java index b9b6bfba0767c..10b4762c600d2 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/LeafBucketCollector.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/LeafBucketCollector.java @@ -13,8 +13,6 @@ import org.elasticsearch.search.aggregations.bucket.terms.LongKeyedBucketOrds; import java.io.IOException; -import java.util.stream.Stream; -import java.util.stream.StreamSupport; /** * Collects results for a particular segment. See the docs for @@ -44,36 +42,6 @@ public boolean isNoop() { } }; - public static LeafBucketCollector wrap(Iterable collectors) { - final Stream actualCollectors = StreamSupport.stream(collectors.spliterator(), false) - .filter(c -> c != NO_OP_COLLECTOR); - final LeafBucketCollector[] colls = actualCollectors.toArray(size -> new LeafBucketCollector[size]); - switch (colls.length) { - case 0: - return NO_OP_COLLECTOR; - case 1: - return colls[0]; - default: - return new LeafBucketCollector() { - - @Override - public void setScorer(Scorable s) throws IOException { - for (LeafBucketCollector c : colls) { - c.setScorer(s); - } - } - - @Override - public void collect(int doc, long bucket) throws IOException { - for (LeafBucketCollector c : colls) { - c.collect(doc, bucket); - } - } - - }; - } - } - /** * Collect the given {@code doc} in the bucket owned by * {@code owningBucketOrd}.