Skip to content

Commit 45aea28

Browse files
committed
Fix TophitsAggregatorTests
It needs a DirectoryReader so it has to be careful. Closes #22818
1 parent 18d4b5b commit 45aea28

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

core/src/test/java/org/elasticsearch/search/aggregations/metrics/tophits/TopHitsAggregatorTests.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,8 @@ private Aggregation testCase(Query query, AggregationBuilder builder) throws IOE
130130
iw.close();
131131

132132
IndexReader indexReader = DirectoryReader.open(directory);
133-
IndexSearcher indexSearcher = newSearcher(indexReader, true, true);
133+
// We do not use LuceneTestCase.newSearcher because we need a DirectoryReader for "testInsideTerms"
134+
IndexSearcher indexSearcher = new IndexSearcher(indexReader);
134135

135136
Aggregation result = searchAndReduce(indexSearcher, query, builder, STRING_FIELD_TYPE);
136137
indexReader.close();

0 commit comments

Comments
 (0)