### 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
static IndexingResult indexDocs(int numRequests, int numThreads) throws Exception {
        final AtomicInteger completedRequests = new AtomicInteger();
        final AtomicInteger numSuccess = new AtomicInteger();
        final AtomicInteger numFailure = new AtomicInteger();
        Thread[] indexers = new Thread[numThreads];
        Phaser phaser = new Phaser(indexers.length);
        for (int i = 0; i < indexers.length; i++) {
            indexers[i] = new Thread(() -> {
                phaser.arriveAndAwaitAdvance();
                while (completedRequests.incrementAndGet() <= numRequests) {
                    try {
                        final IndexResponse resp = client().prepareIndex("test").setSource("{}", XContentType.JSON).get();
                        numSuccess.incrementAndGet();
                        assertThat(resp.status(), equalTo(RestStatus.CREATED));
                    } catch (IllegalArgumentException e) {
                        numFailure.incrementAndGet();
                        assertThat(e.getMessage(), containsString("Number of documents in the index can't exceed [" + maxDocs.get() + "]"));
                    }
                }
            });
            indexers[i].start();
        }
        for (Thread indexer : indexers) {
            indexer.join();
        }
        internalCluster().assertNoInFlightDocsInEngine();
        return new IndexingResult(numSuccess.get(), numFailure.get());
    }
}