Skip to content

Commit 758eb9d

Browse files
committed
Track accurate total hits in CloseIndexIT
The test was not using the TRACK_TOTAL_HITS_ACCURATE and thus encountered a different issue tracked in #37907. In the meanwhile we can adapt the test to not fail anymore. Closes #37897
1 parent c0409fb commit 758eb9d

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

server/src/test/java/org/elasticsearch/indices/state/CloseIndexIT.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
import static java.util.Collections.emptySet;
4242
import static java.util.stream.Collectors.toList;
4343
import static org.elasticsearch.action.support.IndicesOptions.lenientExpandOpen;
44+
import static org.elasticsearch.search.internal.SearchContext.TRACK_TOTAL_HITS_ACCURATE;
4445
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
4546
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHitCount;
4647
import static org.hamcrest.Matchers.containsString;
@@ -188,7 +189,7 @@ public void testCloseWhileIndexingDocuments() throws Exception {
188189

189190
assertIndexIsClosed(indexName);
190191
assertAcked(client().admin().indices().prepareOpen(indexName));
191-
assertHitCount(client().prepareSearch(indexName).setSize(0).setTrackTotalHitsUpTo(MAX_DOCS).get(), nbDocs);
192+
assertHitCount(client().prepareSearch(indexName).setSize(0).setTrackTotalHitsUpTo(TRACK_TOTAL_HITS_ACCURATE).get(), nbDocs);
192193
}
193194

194195
public void testCloseWhileDeletingIndices() throws Exception {
@@ -301,7 +302,7 @@ public void testConcurrentClosesAndOpens() throws Exception {
301302
}
302303
refresh(indexName);
303304
assertIndexIsOpened(indexName);
304-
assertHitCount(client().prepareSearch(indexName).setSize(0).setTrackTotalHitsUpTo(MAX_DOCS).get(),
305+
assertHitCount(client().prepareSearch(indexName).setSize(0).setTrackTotalHitsUpTo(TRACK_TOTAL_HITS_ACCURATE).get(),
305306
indexer.totalIndexedDocs());
306307
}
307308

0 commit comments

Comments
 (0)