SearchServiceTests.testIsParallelCollectionSupportedForResults fails intermittently

```
12:37:10 org.elasticsearch.search.SearchServiceTests > testIsParallelCollectionSupportedForResults FAILED
12:37:10     java.lang.AssertionError
12:37:10         at __randomizedtesting.SeedInfo.seed([4140C168DE8FB0BB:771A78D5E4B36180]:0)
12:37:10         at org.junit.Assert.fail(Assert.java:86)
12:37:10         at org.junit.Assert.assertTrue(Assert.java:41)
12:37:10         at org.junit.Assert.assertFalse(Assert.java:64)
12:37:10         at org.junit.Assert.assertFalse(Assert.java:74)
12:37:10         at org.elasticsearch.search.SearchServiceTests.testIsParallelCollectionSupportedForResults(SearchServiceTests.java:2096)
```

```
./gradlew ':server:test' --tests "org.elasticsearch.search.SearchServiceTests.testIsParallelCollectionSupportedForResults" -Dtests.seed=4140C168DE8FB0BB -Dtests.locale=es-SV -Dtests.timezone=Africa/Banjul -Druntime.java=20
```
server/src/test/java/org/elasticsearch/search/SearchServiceTests.java
expectThrows(
            SearchPhaseExecutionException.class,
            () -> client().prepareSearch("index").setQuery(new FailOnRewriteQueryBuilder()).get()
        );
        assertEquals(activeContexts, service.getActiveContexts());
        assertEquals(activeRefs, indexShard.store().refCount());
    }
    public void testSearchWhileIndexDeleted() throws InterruptedException {
        createIndex("index");
        client().prepareIndex("index").setId("1").setSource("field", "value").setRefreshPolicy(IMMEDIATE).get();
        SearchService service = getInstanceFromNode(SearchService.class);
        IndicesService indicesService = getInstanceFromNode(IndicesService.class);
        IndexService indexService = indicesService.indexServiceSafe(resolveIndex("index"));
        IndexShard indexShard = indexService.getShard(0);
        AtomicBoolean running = new AtomicBoolean(true);
        CountDownLatch startGun = new CountDownLatch(1);
        Semaphore semaphore = new Semaphore(Integer.MAX_VALUE);
        ShardRouting routing = TestShardRouting.newShardRouting(
            indexShard.shardId(),
            randomAlphaOfLength(5),
            randomBoolean(),
            ShardRoutingState.INITIALIZING
        );
        final Thread thread = new Thread() {
            @Override
            public void run() {
                startGun.countDown();
                while (running.get()) {
                    if (randomBoolean()) {
                        service.afterIndexRemoved(indexService.index(), indexService.getIndexSettings(), DELETED);