### CI Link

only saw it locally

### Repro line

./gradlew ':server:test' --tests "org.elasticsearch.index.mapper.flattened.FlattenedFieldSearchTests.testCardinalityAggregation" -Dtests.seed=6E5A7D9AA8064CD5 -Dtests.locale=sr -Dtests.timezone=America/Campo_Grande -Druntime.java=18

### Does it reproduce?

Yes

### Applicable branches

master

### Failure history

_No response_

### Failure excerpt

```
REPRODUCE WITH: ./gradlew ':server:test' --tests "org.elasticsearch.index.mapper.flattened.FlattenedFieldSearchTests.testCardinalityAggregation" -Dtests.seed=EC78A8CA6F57105F -Dtests.locale=sv -Dtests.timezone=SystemV/MST7MDT -Druntime.java=18
  java.lang.AssertionError: 
    Expected: a value greater than <0L>
         but: <0L> was equal to <0L>
        at __randomizedtesting.SeedInfo.seed([EC78A8CA6F57105F:85146484AA481FC8]:0)
        at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:18)
        at org.junit.Assert.assertThat(Assert.java:956)
        at org.junit.Assert.assertThat(Assert.java:923)
        at org.elasticsearch.index.mapper.flattened.FlattenedFieldSearchTests.assertCardinality(FlattenedFieldSearchTests.java:275)
        at org.elasticsearch.index.mapper.flattened.FlattenedFieldSearchTests.testCardinalityAggregation(FlattenedFieldSearchTests.java:249)
```

Reproduces every time for me locally. Will mute.

server/src/test/java/org/elasticsearch/index/mapper/flattened/FlattenedFieldSearchTests.java
assertOrderedSearchHits(response, "2", "1", "3");
        response = client().prepareSearch("test").addSort(new FieldSortBuilder("flattened.key").order(SortOrder.DESC).missing("Z")).get();
        assertSearchResponse(response);
        assertHitCount(response, 3);
        assertOrderedSearchHits(response, "3", "2", "1");
    }
    public void testSourceFiltering() {
        Map<String, Object> headers = new HashMap<>();
        headers.put("content-type", "application/json");
        headers.put("origin", "https://www.elastic.co");
        Map<String, Object> source = Collections.singletonMap("headers", headers);
        client().prepareIndex("test").setId("1").setRefreshPolicy(RefreshPolicy.IMMEDIATE).setSource(source).get();
        SearchResponse response = client().prepareSearch("test").setFetchSource(true).get();
        assertThat(response.getHits().getAt(0).getSourceAsMap(), equalTo(source));
        
        response = client().prepareSearch("test").setFetchSource("headers", null).get();
        assertThat(response.getHits().getAt(0).getSourceAsMap(), equalTo(source));
        response = client().prepareSearch("test").setFetchSource("headers.content-type", null).get();
        Map<String, Object> filteredSource = Collections.singletonMap(
            "headers",
            Collections.singletonMap("content-type", "application/json")
        );
        assertThat(response.getHits().getAt(0).getSourceAsMap(), equalTo(filteredSource));
        
        response = client().prepareSearch("test").setFetchSource(null, "headers.content-type").get();
        filteredSource = Collections.singletonMap("headers", Collections.singletonMap("origin", "https://www.elastic.co"));
        assertThat(response.getHits().getAt(0).getSourceAsMap(), equalTo(filteredSource));
    }
}