### CI Link

https://gradle-enterprise.elastic.co/s/wz3ofquvkhbem/console-log/raw

### Repro line

```
 ./gradlew ':docs:yamlRestTest' --tests "org.elasticsearch.smoketest.DocsClientYamlTestSuiteIT.test {yaml=reference/query-dsl/simple-query-string-query/line_291}" -Dtests.seed=E12124F261F0BF90 -Dtests.locale=es-US -Dtests.timezone=US/Central -Druntime.java=21
```

### Does it reproduce?

no

### Applicable branches

main

### Failure history

Didn't load.

### Failure excerpt

```

REPRODUCE WITH: ./gradlew ':docs:yamlRestTest' --tests "org.elasticsearch.smoketest.DocsClientYamlTestSuiteIT.test {yaml=reference/query-dsl/simple-query-string-query/line_291}" -Dtests.seed=E12124F261F0BF90 -Dtests.locale=es-US -Dtests.timezone=US/Central -Druntime.java=21

org.elasticsearch.smoketest.DocsClientYamlTestSuiteIT > test {yaml=reference/query-dsl/simple-query-string-query/line_291} FAILED
    org.elasticsearch.client.ResponseException: method [DELETE], host [http://127.0.0.1:43027], URI [*,-.ds-ilm-history-*?expand_wildcards=open%2Cclosed%2Chidden], status line [HTTP/1.1 400 Bad Request]
    {"error":{"root_cause":[{"type":"illegal_argument_exception","reason":"index [.ds-.slm-history-5-2023.10.09-000001] is the write index for data stream [.slm-history-5] and cannot be deleted"}],"type":"illegal_argument_exception","reason":"index [.ds-.slm-history-5-2023.10.09-000001] is the write index for data stream [.slm-history-5] and cannot be deleted"},"status":400}
        at __randomizedtesting.SeedInfo.seed([E12124F261F0BF90:69751B28CF0CD268]:0)
        at app//org.elasticsearch.client.RestClient.convertResponse(RestClient.java:347)
        at app//org.elasticsearch.client.RestClient.performRequest(RestClient.java:313)
        at app//org.elasticsearch.client.RestClient.performRequest(RestClient.java:288)
        at app//org.elasticsearch.test.rest.ESRestTestCase.wipeAllIndices(ESRestTestCase.java:981)
        at app//org.elasticsearch.test.rest.ESRestTestCase.wipeCluster(ESRestTestCase.java:729)
        at app//org.elasticsearch.test.rest.ESRestTestCase.cleanUpCluster(ESRestTestCase.java:421)
        at java.base@21/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
        at java.base@21/java.lang.reflect.Method.invoke(Method.java:580)
        at app//com.carrotsearch.randomizedtesting.RandomizedRunner.invoke(RandomizedRunner.java:1758)
```
test/framework/src/main/java/org/elasticsearch/test/rest/ESRestTestCase.java
if (shard.get("primary") == Boolean.FALSE && targetNode.test((String) XContentMapValues.extractValue("target.name", shard))) {
                List<?> details = (List<?>) XContentMapValues.extractValue("index.files.details", shard);
                
                if (details == null) {
                    long totalFiles = ((Number) XContentMapValues.extractValue("index.files.total", shard)).longValue();
                    long reusedFiles = ((Number) XContentMapValues.extractValue("index.files.reused", shard)).longValue();
                    logger.info("total [{}] reused [{}]", totalFiles, reusedFiles);
                    assertThat("must reuse all files, recoveries [" + recoveries + "]", totalFiles, equalTo(reusedFiles));
                } else {
                    assertNotNull(details);
                    assertThat(details, Matchers.empty());
                }
                foundReplica = true;
            }
        }
        assertTrue("must find replica", foundReplica);
    }
    /**
     * Asserts that we do not retain any extra translog for the given index (i.e., turn off the translog retention)
     */
    public void assertEmptyTranslog(String index) throws Exception {
        Map<String, Object> stats = entityAsMap(client().performRequest(new Request("GET", index + "/_stats?level=shards")));
        assertThat(XContentMapValues.extractValue("indices." + index + ".total.translog.uncommitted_operations", stats), equalTo(0));
        assertThat(XContentMapValues.extractValue("indices." + index + ".total.translog.operations", stats), equalTo(0));
    }
    /**
     * Peer recovery retention leases are renewed and synced to replicas periodically (every 30 seconds). This ensures
     * that we have renewed every PRRL to the global checkpoint of the corresponding copy and properly synced to all copies.
     */
    public void ensurePeerRecoveryRetentionLeasesRenewedAndSynced(String index) throws Exception {