### CI Link

https://gradle-enterprise.elastic.co/s/oadbbzpxkn6tg/tests/:x-pack:plugin:enrich:qa:rest-with-security:javaRestTest/org.elasticsearch.xpack.enrich.EnrichSecurityIT/testBasicFlowDouble?top-execution=1

### Repro line

https://gradle-enterprise.elastic.co/s/oadbbzpxkn6tg

### Does it reproduce?

No

### Applicable branches

master

### Failure history

_No response_

### Failure excerpt

org.elasticsearch.client.WarningFailureException: method [PUT], host [http://127.0.0.1:41171], URI [/my-index/_doc/1?pipeline=my_pipeline], status line [HTTP/1.1 201 Created] 
Warnings: [index name [.monitoring-es-7-2022.02.01] starts with a dot '.', in the next major version, index names starting with a dot are reserved for hidden indices and system indices] |  
{"_index":"my-index","_id":"1","_version":1,"result":"created","_shards":{"total":2,"successful":1,"failed":0},"_seq_no":0,"_primary_term":1}


failed tests
EnrichSecurityIT » testBasicFlowDouble
EnrichSecurityIT » testDeleteExistingPipeline
EnrichSecurityIT » testBasicFlowDate
EnrichSecurityIT » testImmutablePolicy
EnrichSecurityIT » testBasicFlowKeyword
EnrichSecurityIT » testDeleteIsCaseSensitive



x-pack/plugin/enrich/qa/common/src/main/java/org/elasticsearch/test/enrich/CommonEnrichRestTestCase.java
ResponseException.class,
            () -> client().performRequest(new Request("DELETE", "/_enrich/policy/MY_POLICY"))
        );
        assertTrue(exc.getMessage().contains("policy [MY_POLICY] not found"));
    }
    public void testDeleteExistingPipeline() throws Exception {
        setupGenericLifecycleTest("host", "match", "elastic.co");
        Request putPipelineRequest = new Request("PUT", "/_ingest/pipeline/another_pipeline");
        putPipelineRequest.setJsonEntity("""
            {
              "processors": [ { "enrich": { "policy_name": "my_policy", "field": "host", "target_field": "entry" } } ]
            }""");
        assertOK(client().performRequest(putPipelineRequest));
        cleanupPipelineAfterTest("another_pipeline");
        ResponseException exc = expectThrows(
            ResponseException.class,
            () -> client().performRequest(new Request("DELETE", "/_enrich/policy/my_policy"))
        );
        assertTrue(exc.getMessage().contains("Could not delete policy [my_policy] because a pipeline is referencing it ["));
        assertTrue(exc.getMessage().contains("another_pipeline"));
        assertTrue(exc.getMessage().contains("my_pipeline"));
        
        Request getRequest = new Request("GET", "/_enrich/policy/my_policy");
        assertOK(client().performRequest(getRequest));
    }
    public static String generatePolicySource(String index) throws IOException {
        return generatePolicySource(index, "host", "match");
    }
    public static String generatePolicySource(String index, String field, String type) throws IOException {
        XContentBuilder source = jsonBuilder().startObject().startObject(type);