### 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
)
            );
        }
        BulkResponse bulkResponse = bulkRequest.get();
        assertNoFailures(bulkResponse);
        
        TermsAggregationBuilder builder = createTermsAgg("labels");
        SearchResponse response = client().prepareSearch("test").addAggregation(builder).get();
        assertSearchResponse(response);
        Terms terms = response.getAggregations().get("terms");
        assertThat(terms, notNullValue());
        assertThat(terms.getName(), equalTo("terms"));
        assertThat(terms.getBuckets().size(), equalTo(6));
        Terms.Bucket bucket1 = terms.getBuckets().get(0);
        assertEquals("urgent", bucket1.getKey());
        assertEquals(5, bucket1.getDocCount());
        Terms.Bucket bucket2 = terms.getBuckets().get(1);
        assertThat(bucket2.getKeyAsString(), startsWith("v1.2."));
        assertEquals(1, bucket2.getDocCount());
        
        TermsAggregationBuilder priorityAgg = createTermsAgg("labels.priority");
        SearchResponse priorityResponse = client().prepareSearch("test").addAggregation(priorityAgg).get();
        assertSearchResponse(priorityResponse);
        Terms priorityTerms = priorityResponse.getAggregations().get("terms");
        assertThat(priorityTerms, notNullValue());
        assertThat(priorityTerms.getName(), equalTo("terms"));
        assertThat(priorityTerms.getBuckets().size(), equalTo(1));
        Terms.Bucket priorityBucket = priorityTerms.getBuckets().get(0);
        assertEquals("urgent", priorityBucket.getKey());
        assertEquals(5, priorityBucket.getDocCount());