diff options
Diffstat (limited to 'core/src/test/java/org/elasticsearch/search/aggregations/bucket/GlobalAggregatorTests.java')
-rw-r--r-- | core/src/test/java/org/elasticsearch/search/aggregations/bucket/GlobalAggregatorTests.java | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/core/src/test/java/org/elasticsearch/search/aggregations/bucket/GlobalAggregatorTests.java b/core/src/test/java/org/elasticsearch/search/aggregations/bucket/GlobalAggregatorTests.java index 571a32b87b..67bec2acf7 100644 --- a/core/src/test/java/org/elasticsearch/search/aggregations/bucket/GlobalAggregatorTests.java +++ b/core/src/test/java/org/elasticsearch/search/aggregations/bucket/GlobalAggregatorTests.java @@ -78,17 +78,14 @@ public class GlobalAggregatorTests extends AggregatorTestCase { aggregationBuilder.subAggregation(new MinAggregationBuilder("in_global").field("number")); MappedFieldType fieldType = new NumberFieldMapper.NumberFieldType(NumberFieldMapper.NumberType.LONG); fieldType.setName("number"); - try (GlobalAggregator aggregator = createAggregator(aggregationBuilder, indexSearcher, fieldType)) { - try { - aggregator.preCollection(); - indexSearcher.search(new MatchAllDocsQuery(), aggregator); - aggregator.postCollection(); - InternalGlobal result = (InternalGlobal) aggregator.buildAggregation(0L); - verify.accept(result, (InternalMin) result.getAggregations().asMap().get("in_global")); - } finally { - IOUtils.close(aggregator.subAggregators()); - } - } + + GlobalAggregator aggregator = createAggregator(aggregationBuilder, indexSearcher, fieldType); + aggregator.preCollection(); + indexSearcher.search(new MatchAllDocsQuery(), aggregator); + aggregator.postCollection(); + InternalGlobal result = (InternalGlobal) aggregator.buildAggregation(0L); + verify.accept(result, (InternalMin) result.getAggregations().asMap().get("in_global")); + indexReader.close(); directory.close(); } |