### Elasticsearch Version

8.8.2

### Installed Plugins

_No response_

### Java Version

_bundled_

### OS Version

Mac OS X

### Problem Description

Under certain conditions, fetching a particular field value using the "fields" API can lead to `string_index_out_of_bounds_exception`.
The queried field needs to be inside a "nested" object and in addition to the field name, all fields need to be queries as well (`*`).
Both fields requested also need to be requested with `"include_unmapped": true`. 

### Steps to Reproduce

```
DELETE testindex

PUT testindex
{
    "mappings": {
        "dynamic": "false",
        "properties": {
            "nested_field": {
                "type": "nested",
                "properties": {
                    "file": {
                        "type": "keyword"
                    }
                }
            }
        }
    }
}

POST testindex/_doc
{
    "nested_field": {        
            "file": "somefile.txt"
    }
}

GET testindex/_search
{
  "_source": false,
  "fields": [
    {
      "field": "file",
      "include_unmapped": true
    },
    {
      "field": "*",
      "include_unmapped": true
    }
  ],
  "query": {
    "match_all" : {}
  }
}
```

This gives the following error:
```
{
    "error": {
        [...],
        "caused_by": {
            "type": "string_index_out_of_bounds_exception",
            "reason": "Range [13, 4) out of bounds for length 4",
            "caused_by": {
                "type": "string_index_out_of_bounds_exception",
                "reason": "Range [13, 4) out of bounds for length 4"
            }
        }
    },
    "status": 500
}
```

### Logs (if relevant)

_No response_
server/src/test/java/org/elasticsearch/search/fetch/subphase/FieldFetcherTests.java
);
        withLuceneIndex(mapperService, iw -> {
            ParsedDocument parsedDocument = mapperService.documentMapper().parse(source("{}"));
            iw.addDocument(parsedDocument.rootDoc());
        }, iw -> {
            FieldFetcher fieldFetcher = FieldFetcher.create(searchExecutionContext, fieldAndFormatList("_id", null, false));
            IndexSearcher searcher = newSearcher(iw);
            LeafReaderContext readerContext = searcher.getIndexReader().leaves().get(0);
            fieldFetcher.setNextReader(readerContext);
            Map<String, DocumentField> fields = fieldFetcher.fetch(Source.empty(XContentType.JSON), 0);
            assertEquals(1, fields.size());
            DocumentField field = fields.get("_id");
            assertEquals("1", field.getValue());
        });
    }
    public void testStoredFieldsSpec() throws IOException {
        List<FieldAndFormat> fields = List.of(new FieldAndFormat("field", null));
        FieldFetcher fieldFetcher = FieldFetcher.create(newSearchExecutionContext(createMapperService()), fields);
        assertEquals(StoredFieldsSpec.NEEDS_SOURCE, fieldFetcher.storedFieldsSpec());
    }
    private List<FieldAndFormat> fieldAndFormatList(String name, String format, boolean includeUnmapped) {
        return Collections.singletonList(new FieldAndFormat(name, format, includeUnmapped));
    }
    private Map<String, DocumentField> fetchFields(MapperService mapperService, XContentBuilder source, String fieldPattern)
        throws IOException {
        return fetchFields(mapperService, source, fieldAndFormatList(fieldPattern, null, false));
    }
    private static Map<String, DocumentField> fetchFields(MapperService mapperService, XContentBuilder source, List<FieldAndFormat> fields)
        throws IOException {
        Source s = source == null