### 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
@SuppressWarnings("unchecked")
    protected Map<String, Object> getIndexMappingAsMap(String index) throws IOException {
        Map<String, Object> indexSettings = getIndexMapping(index);
        return (Map<String, Object>) ((Map<String, Object>) indexSettings.get(index)).get("mappings");
    }
    protected static boolean indexExists(String index) throws IOException {
        Response response = client().performRequest(new Request("HEAD", "/" + index));
        return RestStatus.OK.getStatus() == response.getStatusLine().getStatusCode();
    }
    /**
     * Deprecation message emitted since {@link Version#V_7_12_0} for the rest of the 7.x series. Can be removed in v9 since it is not
     * emitted in v8. Note that this message is also permitted in certain YAML test cases, it can be removed there too.
     * See https://github.com/elastic/elasticsearch/issues/66419 for more details.
     */
    private static final String WAIT_FOR_ACTIVE_SHARDS_DEFAULT_DEPRECATION_MESSAGE = "the default value for the ?wait_for_active_shards "
        + "parameter will change from '0' to 'index-setting' in version 8; specify '?wait_for_active_shards=index-setting' "
        + "to adopt the future default behaviour, or '?wait_for_active_shards=0' to preserve today's behaviour";
    protected static void closeIndex(String index) throws IOException {
        final Request closeRequest = new Request(HttpPost.METHOD_NAME, "/" + index + "/_close");
        closeRequest.setOptions(expectVersionSpecificWarnings(v -> v.compatible(WAIT_FOR_ACTIVE_SHARDS_DEFAULT_DEPRECATION_MESSAGE)));
        assertOK(client().performRequest(closeRequest));
    }
    protected static void openIndex(String index) throws IOException {
        Response response = client().performRequest(new Request("POST", "/" + index + "/_open"));
        assertThat(response.getStatusLine().getStatusCode(), equalTo(RestStatus.OK.getStatus()));
    }
    protected static boolean aliasExists(String alias) throws IOException {
        Response response = client().performRequest(new Request("HEAD", "/_alias/" + alias));
        return RestStatus.OK.getStatus() == response.getStatusLine().getStatusCode();
    }