|  | @@ -692,7 +692,7 @@ public class TermsAggregatorTests extends AggregatorTestCase {
 | 
	
		
			
				|  |  |                      AggregationContext context = createAggregationContext(indexSearcher, null, fieldType);
 | 
	
		
			
				|  |  |                      TermsAggregator aggregator = createAggregator(aggregationBuilder, context);
 | 
	
		
			
				|  |  |                      aggregator.preCollection();
 | 
	
		
			
				|  |  | -                    indexSearcher.search(new MatchAllDocsQuery(), aggregator);
 | 
	
		
			
				|  |  | +                    indexSearcher.search(new MatchAllDocsQuery(), aggregator.asCollector());
 | 
	
		
			
				|  |  |                      aggregator.postCollection();
 | 
	
		
			
				|  |  |                      Terms result = reduce(aggregationBuilder, aggregator, context.bigArrays());
 | 
	
		
			
				|  |  |                      assertEquals(2, result.getBuckets().size());
 | 
	
	
		
			
				|  | @@ -710,7 +710,7 @@ public class TermsAggregatorTests extends AggregatorTestCase {
 | 
	
		
			
				|  |  |                      context = createAggregationContext(indexSearcher, null, fieldType);
 | 
	
		
			
				|  |  |                      aggregator = createAggregator(aggregationBuilder, context);
 | 
	
		
			
				|  |  |                      aggregator.preCollection();
 | 
	
		
			
				|  |  | -                    indexSearcher.search(new MatchAllDocsQuery(), aggregator);
 | 
	
		
			
				|  |  | +                    indexSearcher.search(new MatchAllDocsQuery(), aggregator.asCollector());
 | 
	
		
			
				|  |  |                      aggregator.postCollection();
 | 
	
		
			
				|  |  |                      result = reduce(aggregationBuilder, aggregator, context.bigArrays());
 | 
	
		
			
				|  |  |                      assertEquals(4, result.getBuckets().size());
 | 
	
	
		
			
				|  | @@ -735,7 +735,7 @@ public class TermsAggregatorTests extends AggregatorTestCase {
 | 
	
		
			
				|  |  |                      context = createAggregationContext(indexSearcher, null, fieldType);
 | 
	
		
			
				|  |  |                      aggregator = createAggregator(aggregationBuilder, context);
 | 
	
		
			
				|  |  |                      aggregator.preCollection();
 | 
	
		
			
				|  |  | -                    indexSearcher.search(new MatchAllDocsQuery(), aggregator);
 | 
	
		
			
				|  |  | +                    indexSearcher.search(new MatchAllDocsQuery(), aggregator.asCollector());
 | 
	
		
			
				|  |  |                      aggregator.postCollection();
 | 
	
		
			
				|  |  |                      result = reduce(aggregationBuilder, aggregator, context.bigArrays());
 | 
	
		
			
				|  |  |                      assertEquals(2, result.getBuckets().size());
 | 
	
	
		
			
				|  | @@ -755,7 +755,7 @@ public class TermsAggregatorTests extends AggregatorTestCase {
 | 
	
		
			
				|  |  |                      context = createAggregationContext(indexSearcher, null, fieldType);
 | 
	
		
			
				|  |  |                      aggregator = createAggregator(aggregationBuilder, context);
 | 
	
		
			
				|  |  |                      aggregator.preCollection();
 | 
	
		
			
				|  |  | -                    indexSearcher.search(new MatchAllDocsQuery(), aggregator);
 | 
	
		
			
				|  |  | +                    indexSearcher.search(new MatchAllDocsQuery(), aggregator.asCollector());
 | 
	
		
			
				|  |  |                      aggregator.postCollection();
 | 
	
		
			
				|  |  |                      result = reduce(aggregationBuilder, aggregator, context.bigArrays());
 | 
	
		
			
				|  |  |                      assertEquals(4, result.getBuckets().size());
 | 
	
	
		
			
				|  | @@ -930,7 +930,7 @@ public class TermsAggregatorTests extends AggregatorTestCase {
 | 
	
		
			
				|  |  |                      AggregationContext context = createAggregationContext(indexSearcher, new MatchAllDocsQuery(), fieldType);
 | 
	
		
			
				|  |  |                      Aggregator aggregator = createAggregator(aggregationBuilder, context);
 | 
	
		
			
				|  |  |                      aggregator.preCollection();
 | 
	
		
			
				|  |  | -                    indexSearcher.search(new MatchAllDocsQuery(), aggregator);
 | 
	
		
			
				|  |  | +                    indexSearcher.search(new MatchAllDocsQuery(), aggregator.asCollector());
 | 
	
		
			
				|  |  |                      aggregator.postCollection();
 | 
	
		
			
				|  |  |                      Terms result = reduce(aggregationBuilder, aggregator, context.bigArrays());
 | 
	
		
			
				|  |  |                      assertEquals(size, result.getBuckets().size());
 | 
	
	
		
			
				|  | @@ -958,7 +958,7 @@ public class TermsAggregatorTests extends AggregatorTestCase {
 | 
	
		
			
				|  |  |                          context = createAggregationContext(indexSearcher, new MatchAllDocsQuery(), fieldType, filterFieldType);
 | 
	
		
			
				|  |  |                          aggregator = createAggregator(aggregationBuilder, context);
 | 
	
		
			
				|  |  |                          aggregator.preCollection();
 | 
	
		
			
				|  |  | -                        indexSearcher.search(new MatchAllDocsQuery(), aggregator);
 | 
	
		
			
				|  |  | +                        indexSearcher.search(new MatchAllDocsQuery(), aggregator.asCollector());
 | 
	
		
			
				|  |  |                          aggregator.postCollection();
 | 
	
		
			
				|  |  |                          result = ((Filter) reduce(aggregationBuilder, aggregator, context.bigArrays())).getAggregations().get("_name2");
 | 
	
		
			
				|  |  |                          int expectedFilteredCounts = 0;
 | 
	
	
		
			
				|  | @@ -1038,7 +1038,7 @@ public class TermsAggregatorTests extends AggregatorTestCase {
 | 
	
		
			
				|  |  |                      AggregationContext context = createAggregationContext(indexSearcher, new MatchAllDocsQuery(), fieldType, fieldType2);
 | 
	
		
			
				|  |  |                      Aggregator aggregator = createAggregator(aggregationBuilder, context);
 | 
	
		
			
				|  |  |                      aggregator.preCollection();
 | 
	
		
			
				|  |  | -                    indexSearcher.search(new MatchAllDocsQuery(), aggregator);
 | 
	
		
			
				|  |  | +                    indexSearcher.search(new MatchAllDocsQuery(), aggregator.asCollector());
 | 
	
		
			
				|  |  |                      aggregator.postCollection();
 | 
	
		
			
				|  |  |                      Terms result = reduce(aggregationBuilder, aggregator, context.bigArrays());
 | 
	
		
			
				|  |  |                      assertEquals(size, result.getBuckets().size());
 | 
	
	
		
			
				|  | @@ -1065,7 +1065,7 @@ public class TermsAggregatorTests extends AggregatorTestCase {
 | 
	
		
			
				|  |  |                      AggregationContext context = createAggregationContext(indexSearcher, null, fieldType1);
 | 
	
		
			
				|  |  |                      Aggregator aggregator = createAggregator(aggregationBuilder, context);
 | 
	
		
			
				|  |  |                      aggregator.preCollection();
 | 
	
		
			
				|  |  | -                    indexSearcher.search(new MatchAllDocsQuery(), aggregator);
 | 
	
		
			
				|  |  | +                    indexSearcher.search(new MatchAllDocsQuery(), aggregator.asCollector());
 | 
	
		
			
				|  |  |                      aggregator.postCollection();
 | 
	
		
			
				|  |  |                      Terms result = reduce(aggregationBuilder, aggregator, context.bigArrays());
 | 
	
		
			
				|  |  |                      assertEquals("_name", result.getName());
 | 
	
	
		
			
				|  | @@ -1075,7 +1075,7 @@ public class TermsAggregatorTests extends AggregatorTestCase {
 | 
	
		
			
				|  |  |                      context = createAggregationContext(indexSearcher, null, fieldType2);
 | 
	
		
			
				|  |  |                      aggregator = createAggregator(aggregationBuilder, context);
 | 
	
		
			
				|  |  |                      aggregator.preCollection();
 | 
	
		
			
				|  |  | -                    indexSearcher.search(new MatchAllDocsQuery(), aggregator);
 | 
	
		
			
				|  |  | +                    indexSearcher.search(new MatchAllDocsQuery(), aggregator.asCollector());
 | 
	
		
			
				|  |  |                      aggregator.postCollection();
 | 
	
		
			
				|  |  |                      result = reduce(aggregationBuilder, aggregator, context.bigArrays());
 | 
	
		
			
				|  |  |                      assertEquals("_name", result.getName());
 | 
	
	
		
			
				|  | @@ -1085,7 +1085,7 @@ public class TermsAggregatorTests extends AggregatorTestCase {
 | 
	
		
			
				|  |  |                      context = createAggregationContext(indexSearcher, null, fieldType3);
 | 
	
		
			
				|  |  |                      aggregator = createAggregator(aggregationBuilder, context);
 | 
	
		
			
				|  |  |                      aggregator.preCollection();
 | 
	
		
			
				|  |  | -                    indexSearcher.search(new MatchAllDocsQuery(), aggregator);
 | 
	
		
			
				|  |  | +                    indexSearcher.search(new MatchAllDocsQuery(), aggregator.asCollector());
 | 
	
		
			
				|  |  |                      aggregator.postCollection();
 | 
	
		
			
				|  |  |                      result = reduce(aggregationBuilder, aggregator, context.bigArrays());
 | 
	
		
			
				|  |  |                      assertEquals("_name", result.getName());
 | 
	
	
		
			
				|  | @@ -1108,7 +1108,7 @@ public class TermsAggregatorTests extends AggregatorTestCase {
 | 
	
		
			
				|  |  |                          AggregationContext context = createAggregationContext(indexSearcher, null);
 | 
	
		
			
				|  |  |                          Aggregator aggregator = createAggregator(aggregationBuilder, context);
 | 
	
		
			
				|  |  |                          aggregator.preCollection();
 | 
	
		
			
				|  |  | -                        indexSearcher.search(new MatchAllDocsQuery(), aggregator);
 | 
	
		
			
				|  |  | +                        indexSearcher.search(new MatchAllDocsQuery(), aggregator.asCollector());
 | 
	
		
			
				|  |  |                          aggregator.postCollection();
 | 
	
		
			
				|  |  |                          Terms result = reduce(aggregationBuilder, aggregator, context.bigArrays());
 | 
	
		
			
				|  |  |                          assertEquals("_name", result.getName());
 | 
	
	
		
			
				|  | @@ -1144,7 +1144,7 @@ public class TermsAggregatorTests extends AggregatorTestCase {
 | 
	
		
			
				|  |  |                          AggregationContext context = createAggregationContext(indexSearcher, new MatchAllDocsQuery(), fieldType1);
 | 
	
		
			
				|  |  |                          Aggregator aggregator = createAggregator(aggregationBuilder, context);
 | 
	
		
			
				|  |  |                          aggregator.preCollection();
 | 
	
		
			
				|  |  | -                        indexSearcher.search(new MatchAllDocsQuery(), aggregator);
 | 
	
		
			
				|  |  | +                        indexSearcher.search(new MatchAllDocsQuery(), aggregator.asCollector());
 | 
	
		
			
				|  |  |                          aggregator.postCollection();
 | 
	
		
			
				|  |  |                          Terms result = reduce(aggregationBuilder, aggregator, context.bigArrays());
 | 
	
		
			
				|  |  |                          assertEquals("_name", result.getName());
 | 
	
	
		
			
				|  | @@ -1260,7 +1260,7 @@ public class TermsAggregatorTests extends AggregatorTestCase {
 | 
	
		
			
				|  |  |                      AggregationContext context = createAggregationContext(indexSearcher, new MatchAllDocsQuery(), fieldType1, fieldType2);
 | 
	
		
			
				|  |  |                      Aggregator aggregator = createAggregator(aggregationBuilder, context);
 | 
	
		
			
				|  |  |                      aggregator.preCollection();
 | 
	
		
			
				|  |  | -                    indexSearcher.search(new MatchAllDocsQuery(), aggregator);
 | 
	
		
			
				|  |  | +                    indexSearcher.search(new MatchAllDocsQuery(), aggregator.asCollector());
 | 
	
		
			
				|  |  |                      aggregator.postCollection();
 | 
	
		
			
				|  |  |                      Terms result = reduce(aggregationBuilder, aggregator, context.bigArrays());
 | 
	
		
			
				|  |  |                      assertEquals(3, result.getBuckets().size());
 | 
	
	
		
			
				|  | @@ -2325,7 +2325,7 @@ public class TermsAggregatorTests extends AggregatorTestCase {
 | 
	
		
			
				|  |  |          throws IOException {
 | 
	
		
			
				|  |  |          TermsAggregator aggregator = createAggregator(builder, searcher, fieldType);
 | 
	
		
			
				|  |  |          aggregator.preCollection();
 | 
	
		
			
				|  |  | -        searcher.search(new MatchAllDocsQuery(), aggregator);
 | 
	
		
			
				|  |  | +        searcher.search(new MatchAllDocsQuery(), aggregator.asCollector());
 | 
	
		
			
				|  |  |          aggregator.postCollection();
 | 
	
		
			
				|  |  |          return aggregator.buildTopLevel();
 | 
	
		
			
				|  |  |      }
 |