### Elasticsearch Version

8.8.1

### Installed Plugins

_No response_

### Java Version

_bundled_

### OS Version

ESS

### Problem Description

The `reroute` processor allows to specific Mustache like syntax for field references. In contrast to other processors (.e.g `set` or `rename`) the variable does not allow to include spaces between the field name and the curly brackets.

This doesn't work:
```
"dataset": "{{ _reroute.dataset }}"
```
while this does:
```
"dataset": "{{_reroute.dataset}}"
```


### Steps to Reproduce

```
PUT _ingest/pipeline/reroute_example
{
  "processors": [
    {
      "reroute": {
        "tag": "example",
        "dataset": "{{ _reroute.dataset }}"
      }
    }
  ]
}

POST logs-test.original-default/_doc?pipeline=reroute_example
{
  "_reroute": {
    "dataset": "test.reroute"
  },
  "@timestamp": "2023-06-20"
}
```

Notice how the target Data Stream is `logs-test.original-default` instead of `logs-test.reroute-default`

### Logs (if relevant)

_No response_
modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/RerouteProcessorTests.java
assertThat(e.getMessage(), equalTo("field [numeric_field] of type [java.lang.Integer] cannot be cast to [java.lang.String]"));
    }
    public void testDatasetSanitization() {
        assertDatasetSanitization("\\/*?\"<>| ,#:-", "_____________");
        assertDatasetSanitization("foo*bar", "foo_bar");
    }
    public void testNamespaceSanitization() {
        assertNamespaceSanitization("\\/*?\"<>| ,#:-", "____________-");
        assertNamespaceSanitization("foo*bar", "foo_bar");
    }
    private static void assertDatasetSanitization(String dataset, String sanitizedDataset) {
        assertThat(
            RerouteProcessor.DataStreamValueSource.dataset("{{foo}}")
                .resolve(RandomDocumentPicks.randomIngestDocument(random(), Map.of("foo", dataset))),
            equalTo(sanitizedDataset)
        );
    }
    private static void assertNamespaceSanitization(String namespace, String sanitizedNamespace) {
        assertThat(
            RerouteProcessor.DataStreamValueSource.namespace("{{foo}}")
                .resolve(RandomDocumentPicks.randomIngestDocument(random(), Map.of("foo", namespace))),
            equalTo(sanitizedNamespace)
        );
    }
    private RerouteProcessor createRerouteProcessor(List<String> dataset, List<String> namespace) {
        return new RerouteProcessor(
            null,
            null,
            dataset.stream().map(RerouteProcessor.DataStreamValueSource::dataset).toList(),
            namespace.stream().map(RerouteProcessor.DataStreamValueSource::namespace).toList(),