### CI Link

https://gradle-enterprise.elastic.co/s/ttoy2fz7vpo3a/tests/:server:internalClusterTest/org.elasticsearch.index.engine.MaxDocsLimitIT/testMaxDocsLimit

### Repro line

`./gradlew ':server:internalClusterTest' --tests "org.elasticsearch.index.engine.MaxDocsLimitIT.testMaxDocsLimit" -Dtests.seed=87A99F29C5284169 -Dtests.locale=es-PR -Dtests.timezone=America/Mazatlan -Druntime.java=17`

### Does it reproduce?

Yes

### Applicable branches

main

### Failure history

https://gradle-enterprise.elastic.co/scans/tests?search.timeZoneId=Europe/Berlin&tests.container=org.elasticsearch.index.engine.MaxDocsLimitIT&tests.test=testMaxDocsLimit#

### Failure excerpt

```
org.elasticsearch.ResourceAlreadyExistsException: index [test/JWxXBgp8T0CNYCD7JwrRlw] already exists	
	at __randomizedtesting.SeedInfo.seed([87A99F29C5284169:39D24887ACAF7B57]:0)	
	at org.elasticsearch.cluster.metadata.MetadataCreateIndexService.validateIndexName(MetadataCreateIndexService.java:175)	
	at org.elasticsearch.cluster.metadata.MetadataCreateIndexService.validate(MetadataCreateIndexService.java:1360)	
	at org.elasticsearch.cluster.metadata.MetadataCreateIndexService.applyCreateIndexRequest(MetadataCreateIndexService.java:343)	
	at org.elasticsearch.cluster.metadata.MetadataCreateIndexService$1.execute(MetadataCreateIndexService.java:298)	
	at org.elasticsearch.cluster.service.MasterService$UnbatchedExecutor.execute(MasterService.java:551)	
	at org.elasticsearch.cluster.service.MasterService.innerExecuteTasks(MasterService.java:1052)	
	at org.elasticsearch.cluster.service.MasterService.executeTasks(MasterService.java:1017)	
	at org.elasticsearch.cluster.service.MasterService.runTasks(MasterService.java:278)	
	at org.elasticsearch.cluster.service.MasterService$Batcher.run(MasterService.java:170)	
	at org.elasticsearch.cluster.service.TaskBatcher.runIfNotProcessed(TaskBatcher.java:110)	
	at org.elasticsearch.cluster.service.TaskBatcher$BatchedTask.run(TaskBatcher.java:148)	
	at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingRunnable.run(ThreadContext.java:850)	
	at org.elasticsearch.common.util.concurrent.PrioritizedEsThreadPoolExecutor$TieBreakingPrioritizedRunnable.runAndClean(PrioritizedEsThreadPoolExecutor.java:257)	
	at org.elasticsearch.common.util.concurrent.PrioritizedEsThreadPoolExecutor$TieBreakingPrioritizedRunnable.run(PrioritizedEsThreadPoolExecutor.java:223)	
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)	
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)	
	at java.lang.Thread.run(Thread.java:833)	
```	
server/src/internalClusterTest/java/org/elasticsearch/index/engine/MaxDocsLimitIT.java
);
        assertThat(deleteError.getMessage(), containsString("Number of documents in the index can't exceed [" + maxDocs.get() + "]"));
        client().admin().indices().prepareRefresh("test").get();
        SearchResponse searchResponse = client().prepareSearch("test")
            .setQuery(new MatchAllQueryBuilder())
            .setTrackTotalHitsUpTo(Integer.MAX_VALUE)
            .setSize(0)
            .get();
        ElasticsearchAssertions.assertNoFailures(searchResponse);
        assertThat(searchResponse.getHits().getTotalHits().value, equalTo((long) maxDocs.get()));
        if (randomBoolean()) {
            client().admin().indices().prepareFlush("test").get();
        }
        internalCluster().fullRestart();
        internalCluster().ensureAtLeastNumDataNodes(2);
        ensureGreen("test");
        searchResponse = client().prepareSearch("test")
            .setQuery(new MatchAllQueryBuilder())
            .setTrackTotalHitsUpTo(Integer.MAX_VALUE)
            .setSize(0)
            .get();
        ElasticsearchAssertions.assertNoFailures(searchResponse);
        assertThat(searchResponse.getHits().getTotalHits().value, equalTo((long) maxDocs.get()));
    }
    public void testMaxDocsLimitConcurrently() throws Exception {
        internalCluster().ensureAtLeastNumDataNodes(1);
        assertAcked(
            client().admin().indices().prepareCreate("test").setSettings(Settings.builder().put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1))
        );
        IndexingResult indexingResult = indexDocs(between(maxDocs.get() + 1, maxDocs.get() * 2), between(2, 8));