### Elasticsearch Version

8.6.2

### Installed Plugins

_No response_

### Java Version

Oracle Corporation/Java HotSpot(TM) 64-Bit Server VM/18.0.2/18.0.2+9-61

### OS Version

Mac OS X/12.6.3/aarch64

### Problem Description

The [fields option](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-fields.htm) lets you query the
metadata `_id` field, but this field doesn't seem to be returned consistently over larger search result sets.


### Steps to Reproduce

 add several small documents to a test index with e.g.
```
POST /test/_doc
{
  "foo" : "bar"
}
```
then query e.g. top 10 docs disabling `_source` and querying `_id` via `fields`:

```
GET test/_search
{
  "_source": false,
  "fields": [
    "_id"
  ],
  "size": 10,
  "query": {
    "match_all": {}
  }
}
```

In my current reproduction on 8.6.2 this returns e.g.
```
  "hits": [
            {
                "_index": "test",
                "_id": "082y5YYBJUrNWn3IOYNS",
                "_score": 1,
                "fields": {
                    "_id": [
                        "082y5YYBJUrNWn3IOYNS"
                    ]
                }
            },
            {
                "_index": "test",
                "_id": "1M2y5YYBJUrNWn3IQIOO",
                "_score": 1,
                "fields": {
                    "_id": [
                        "1M2y5YYBJUrNWn3IQIOO"
                    ]
                }
            },
            {
                "_index": "test",
                "_id": "1c2y5YYBJUrNWn3IRYNb",
                "_score": 1,
                "fields": {
                    "_id": [
                        "1c2y5YYBJUrNWn3IRYNb"
                    ]
                }
            },
            {
                "_index": "test",
                "_id": "1s2y5YYBJUrNWn3ITIMM",
                "_score": 1,
                "fields": {
                    "_id": [
                        "1s2y5YYBJUrNWn3ITIMM"
                    ]
                }
            },
            {
                "_index": "test",
                "_id": "182y5YYBJUrNWn3IUIPe",
                "_score": 1,
                "fields": {
                    "_id": [
                        "182y5YYBJUrNWn3IUIPe"
                    ]
                }
            },
            {
                "_index": "test",
                "_id": "2M2z5YYBJUrNWn3IN4O4",
                "_score": 1,
                "fields": {
                    "_id": [
                        "2M2z5YYBJUrNWn3IN4O4"
                    ]
                }
            },
            {
                "_index": "test",
                "_id": "2c2z5YYBJUrNWn3IUoNm",
                "_score": 1
            },
            {
                "_index": "test",
                "_id": "2s2z5YYBJUrNWn3IVYOr",
                "_score": 1
            },
            {
                "_index": "test",
                "_id": "282z5YYBJUrNWn3IWYNq",
                "_score": 1
            },
            {
                "_index": "test",
                "_id": "3M2z5YYBJUrNWn3IW4P9",
                "_score": 1,
                "fields": {
                    "_id": [
                        "3M2z5YYBJUrNWn3IW4P9"
                    ]
                }
            }
```

Notice hits 7-9 without the `_id` field. If queried directly, these documents show the field though:
```
GET test/_search
{
  "_source": false,
  "fields": [
    "_id"
  ],
  "size": 10,
  "query": {
    "match": {
      "_id" : "282z5YYBJUrNWn3IWYNq"
    }
  }
}

--->

"hits": [
            {
                "_index": "test",
                "_id": "282z5YYBJUrNWn3IWYNq",
                "_score": 1,
                "fields": {
                    "_id": [
                        "282z5YYBJUrNWn3IWYNq"
                    ]
                }
            }
        ]
```

Strangely, also changing the "size" seems to change which docs have the `_id` in the `fields` response and which don't.

### Logs (if relevant)

_No response_
server/src/internalClusterTest/java/org/elasticsearch/search/query/SearchQueryIT.java
}
        int num = scaledRandomIntBetween(100, 200);
        IndexRequestBuilder[] builders = new IndexRequestBuilder[num];
        for (int i = 0; i < builders.length; i++) {
            builders[i] = client().prepareIndex("test_1").setId("" + i).setSource("f", English.intToEnglish(i));
        }
        createIndex("test_1");
        indexRandom(true, builders);
        int queryRounds = scaledRandomIntBetween(10, 20);
        for (int i = 0; i < queryRounds; i++) {
            MatchQueryBuilder matchQuery = matchQuery("f", English.intToEnglish(between(0, num)));
            searchResponse = client().prepareSearch("test_1").setQuery(constantScoreQuery(matchQuery)).setSize(num).get();
            long totalHits = searchResponse.getHits().getTotalHits().value;
            SearchHits hits = searchResponse.getHits();
            for (SearchHit searchHit : hits) {
                assertThat(searchHit, hasScore(1.0f));
            }
            searchResponse = client().prepareSearch("test_1")
                .setQuery(
                    boolQuery().must(matchAllQuery())
                        .must(constantScoreQuery(matchQuery).boost(1.0f + (random.nextBoolean() ? 0.0f : random.nextFloat())))
                )
                .setSize(num)
                .get();
            hits = searchResponse.getHits();
            assertThat(hits.getTotalHits().value, equalTo(totalHits));
            if (totalHits > 1) {
                float expected = hits.getAt(0).getScore();
                for (SearchHit searchHit : hits) {
                    assertThat(searchHit, hasScore(expected));