### Elasticsearch Version

main

### Installed Plugins

_No response_

### Java Version

_bundled_

### OS Version

21.6.0 Darwin Kernel Version 21.6.0: Thu Jul  6 22:18:26 PDT 2023; root:xnu-8020.240.18.702.13~1/RELEASE_X86_64 x86_64

### Problem Description

fields option is not returning values with an array of objects. See example in "Steps to Reproduce". Problem brought up in Kibana SDH https://github.com/elastic/sdh-kibana/issues/4114

### Steps to Reproduce

```
PUT test
{}

PUT test/_mapping
{
  "properties": {
    "results": {
      "properties": {
        "value": {
          "type": "geo_point"
        }
      }
    }
  }
}

PUT test/_doc/1
{
  "results": [
    {
      "value": [
        {
          "lat": 0,
          "lon": 0
        }
      ]
    }
  ]
}


POST /test*/_search
{
  "_source": false,
  "fields": [
    "results.value"
  ]
}
```

In the response, notice how fields is not populated and no value is returned

```
{
  "took": 0,
  "timed_out": false,
  "_shards": {
    "total": 1,
    "successful": 1,
    "skipped": 0,
    "failed": 0
  },
  "hits": {
    "total": {
      "value": 1,
      "relation": "eq"
    },
    "max_score": 1,
    "hits": [
      {
        "_index": "test",
        "_id": "1",
        "_score": 1
      }
    ]
  }
}
```

I would expect to get a response like 
```
{
  "took": 0,
  "timed_out": false,
  "_shards": {
    "total": 1,
    "successful": 1,
    "skipped": 0,
    "failed": 0
  },
  "hits": {
    "total": {
      "value": 1,
      "relation": "eq"
    },
    "max_score": 1,
    "hits": [
      {
        "_index": "test",
        "_id": "1",
        "_score": 1,
        "fields": {
          "results.value": [
            {
              "coordinates": [
                0,
                0
              ],
              "type": "Point"
            }
          ]
        }
      }
    ]
  }
}
```

### Logs (if relevant)

_No response_
server/src/main/java/org/elasticsearch/common/xcontent/support/XContentMapValues.java
key += "." + pathElements[nextIndex];
                nextIndex++;
            }
        }
        return null;
    }
    /**
     * Only keep properties in {@code map} that match the {@code includes} but
     * not the {@code excludes}. An empty list of includes is interpreted as a
     * wildcard while an empty list of excludes does not match anything.
     *
     * If a property matches both an include and an exclude, then the exclude
     * wins.
     *
     * If an object matches, then any of its sub properties are automatically
     * considered as matching as well, both for includes and excludes.
     *
     * Dots in field names are treated as sub objects. So for instance if a
     * document contains {@code a.b} as a property and {@code a} is an include,
     * then {@code a.b} will be kept in the filtered map.
     */
    public static Map<String, Object> filter(Map<String, Object> map, String[] includes, String[] excludes) {
        return filter(includes, excludes).apply(map);
    }
    /**
     * Returns a function that filters a document map based on the given include and exclude rules.
     * @see #filter(Map, String[], String[]) for details
     */
    public static Function<Map<String, Object>, Map<String, Object>> filter(String[] includes, String[] excludes) {
        CharacterRunAutomaton matchAllAutomaton = new CharacterRunAutomaton(Automata.makeAnyString());