### Elasticsearch Version

7.17

### Installed Plugins

_No response_

### Java Version

_bundled_

### OS Version

Not relevant

### Problem Description

Creating a match all index template is bad and we know it.
I needed it for a test and I created a new index template with a `*` `index_pattern`.

I wanted to delete it after few minutes (so that it wouldn't picked up by any new index creation) and I couldn't, unless updating it to match no index.

It seems to deny the deletion because it reports being used by data streams.

### Steps to Reproduce

Create a Index Template matching all:
```
PUT _index_template/matchall
{
  "index_patterns": [
    "*"
  ],
  "priority": 1,
  "template": {
    "mappings": {
      "_meta": {
        "class": "lol"
      }
    }
  }
}
```

Try to delete it:
```
DELETE _index_template/matchall
```

You get:
```
{
  "error" : {
    "root_cause" : [
      {
        "type" : "illegal_argument_exception",
        "reason" : "unable to remove composable templates [matchall] as they are in use by a data streams [.fleet-actions-results, .logs-deprecation.elasticsearch-default, .slm-history-5, ilm-history-5, logs-elastic_agent-default, logs-elastic_agent.endpoint_security-default, logs-elastic_agent.filebeat-default, logs-elastic_agent.metricbeat-default, logs-endpoint.events.file-default, logs-endpoint.events.library-default, logs-endpoint.events.network-default, logs-endpoint.events.process-default, logs-endpoint.events.registry-default, logs-endpoint.events.security-default, logs-generic-default, logs-windows.powershell-default, logs-windows.powershell_operational-default, logs-windows.sysmon_operational-default, metrics-elastic_agent.elastic_agent-default, metrics-elastic_agent.endpoint_security-default, metrics-elastic_agent.filebeat-default, metrics-elastic_agent.metricbeat-default, metrics-endpoint.metadata-default, metrics-endpoint.metrics-default, metrics-endpoint.policy-default, metrics-system.cpu-default, metrics-system.diskio-default, metrics-system.memory-default, metrics-system.network-default, metrics-system.process-default, metrics-system.process_summary-default, metrics-system.socket_summary-default, metrics-system.uptime-default, metrics-windows.perfmon-default, metrics-windows.service-default]"
      }
    ],
    "type" : "illegal_argument_exception",
    "reason" : "unable to remove composable templates [matchall] as they are in use by a data streams [.fleet-actions-results, .logs-deprecation.elasticsearch-default, .slm-history-5, ilm-history-5, logs-elastic_agent-default, logs-elastic_agent.endpoint_security-default, logs-elastic_agent.filebeat-default, logs-elastic_agent.metricbeat-default, logs-endpoint.events.file-default, logs-endpoint.events.library-default, logs-endpoint.events.network-default, logs-endpoint.events.process-default, logs-endpoint.events.registry-default, logs-endpoint.events.security-default, logs-generic-default, logs-windows.powershell-default, logs-windows.powershell_operational-default, logs-windows.sysmon_operational-default, metrics-elastic_agent.elastic_agent-default, metrics-elastic_agent.endpoint_security-default, metrics-elastic_agent.filebeat-default, metrics-elastic_agent.metricbeat-default, metrics-endpoint.metadata-default, metrics-endpoint.metrics-default, metrics-endpoint.policy-default, metrics-system.cpu-default, metrics-system.diskio-default, metrics-system.memory-default, metrics-system.network-default, metrics-system.process-default, metrics-system.process_summary-default, metrics-system.socket_summary-default, metrics-system.uptime-default, metrics-windows.perfmon-default, metrics-windows.service-default]"
  },
  "status" : 400
}
```

The list seems to be composed by all the data streams.

## Workaround

Update the `index_patterns` to something non-existing.
```
PUT _index_template/matchall
{
  "index_patterns": [
    "none"
  ],
  "priority": 1,
  "template": {
    "mappings": {
      "_meta": {
        "class": "lol"
      }
    }
  }
}
```

Then delete it:
```
DELETE _index_template/matchall
```

### Logs (if relevant)

_No response_
modules/data-streams/src/internalClusterTest/java/org/elasticsearch/datastreams/DataStreamIT.java
assertTrue(rolloverResponse.isRolledOver());
        getIndexResponse = client().admin().indices().getIndex(new GetIndexRequest().indices(backingIndex)).actionGet();
        assertThat(getIndexResponse.getSettings().get(backingIndex), notNullValue());
        assertThat(getIndexResponse.getSettings().get(backingIndex).getAsBoolean("index.hidden", null), is(true));
        assertThat(
            ObjectPath.eval("properties.baz_field.type", getIndexResponse.mappings().get(backingIndex).getSourceAsMap()),
            equalTo("keyword")
        );
        int numDocs2 = randomIntBetween(2, 16);
        indexDocs(dataStreamName, numDocs2);
        verifyDocs(dataStreamName, numDocs + numDocs2, 1, 2);
        DeleteDataStreamAction.Request deleteDataStreamRequest = new DeleteDataStreamAction.Request(new String[] { dataStreamName });
        client().execute(DeleteDataStreamAction.INSTANCE, deleteDataStreamRequest).actionGet();
        getDataStreamResponse = client().execute(GetDataStreamAction.INSTANCE, getDataStreamRequest).actionGet();
        assertThat(getDataStreamResponse.getDataStreams().size(), equalTo(0));
        expectThrows(
            IndexNotFoundException.class,
            () -> client().admin()
                .indices()
                .getIndex(new GetIndexRequest().indices(DataStream.getDefaultBackingIndexName(dataStreamName, 1)))
                .actionGet()
        );
        expectThrows(
            IndexNotFoundException.class,
            () -> client().admin()
                .indices()
                .getIndex(new GetIndexRequest().indices(DataStream.getDefaultBackingIndexName(dataStreamName, 2)))
                .actionGet()
        );
    }