### Elasticsearch Version

8.6.0

### Installed Plugins

_No response_

### Java Version

_bundled_

### OS Version

Docker

### Problem Description

When testing datemath with complex date strings, I found that some worked and some didn't. I narrowed it down to the existence of the `|` pipe character in the string.

@dakrone seems to think this may be due to how the `IndexNameExpressionResolver` works differently for security-enabled vs. non-security-enabled clusters.

### Steps to Reproduce

## Security Disabled Cluster
```
curl -XGET 'http://localhost:9200/%3Cdatemath-%7B2001-01-01-13%7C%7C%2B1h%2Fh%7Byyyy-MM-dd-HH%7C-07%3A00%7D%7D%3E'
{"error":{"root_cause":[{"type":"illegal_argument_exception","reason":"Cross-cluster calls are not supported in this context but remote indices were requested: [<datemath-{2001-01-01-13||+1h/h{yyyy-MM-dd-HH|-07:00}}>]"}],"type":"illegal_argument_exception","reason":"Cross-cluster calls are not supported in this context but remote indices were requested: [<datemath-{2001-01-01-13||+1h/h{yyyy-MM-dd-HH|-07:00}}>]"},"status":400}%
```

## Security Enabled Cluster

```
curl -XGET -u sample -p 'https://secure.cluster.io/%3Cdatemath-%7B2001-01-01-13%7C%7C%2B1h%2Fh%7Byyyy-MM-dd-HH%7C-07%3A00%7D%7D%3E'
Enter host password for user 'sample':
{"error":{"root_cause":[{"type":"index_not_found_exception","reason":"no such index [datemath-2001-01-01-14]","index_uuid":"_na_","index":"datemath-2001-01-01-14"}],"type":"index_not_found_exception","reason":"no such index [datemath-2001-01-01-14]","index_uuid":"_na_","index":"datemath-2001-01-01-14"},"status":404}%
```

### Logs (if relevant)

_No response_
server/src/test/java/org/elasticsearch/cluster/metadata/IndexNameExpressionResolverTests.java
public void testIndexAliasesDataStreamAliases() {
        final String dataStreamName1 = "logs-foobar";
        final String dataStreamName2 = "logs-barbaz";
        IndexMetadata backingIndex1 = createBackingIndex(dataStreamName1, 1).build();
        IndexMetadata backingIndex2 = createBackingIndex(dataStreamName2, 1).build();
        Metadata.Builder mdBuilder = Metadata.builder()
            .put(backingIndex1, false)
            .put(backingIndex2, false)
            .put(newInstance(dataStreamName1, List.of(backingIndex1.getIndex())))
            .put(newInstance(dataStreamName2, List.of(backingIndex2.getIndex())));
        mdBuilder.put("logs_foo", dataStreamName1, null, "{ \"term\": \"foo\"}");
        mdBuilder.put("logs", dataStreamName1, null, "{ \"term\": \"logs\"}");
        mdBuilder.put("logs_bar", dataStreamName1, null, null);
        mdBuilder.put("logs_baz", dataStreamName2, null, "{ \"term\": \"logs\"}");
        mdBuilder.put("logs_baz2", dataStreamName2, null, null);
        ClusterState state = ClusterState.builder(new ClusterName("_name")).metadata(mdBuilder).build();
        {
            
            Set<String> resolvedExpressions = indexNameExpressionResolver.resolveExpressions(state, "l*");
            String index = backingIndex1.getIndex().getName();
            String[] result = indexNameExpressionResolver.indexAliases(state, index, x -> true, x -> true, true, resolvedExpressions);
            assertThat(result, arrayContainingInAnyOrder("logs_foo", "logs", "logs_bar"));
        }
        {
            
            Set<String> resolvedExpressions = indexNameExpressionResolver.resolveExpressions(state, "l*");
            String index = backingIndex2.getIndex().getName();
            String[] result = indexNameExpressionResolver.indexAliases(state, index, x -> true, x -> true, true, resolvedExpressions);
            assertThat(result, arrayContainingInAnyOrder("logs_baz", "logs_baz2"));
        }