Several tests failed in the same way:


- [NoOrdinalsStringFieldDataTests » classMethod](https://gradle-enterprise.elastic.co/s/criyecvbvjcqy/tests/:server:test/org.elasticsearch.index.fielddata.NoOrdinalsStringFieldDataTests)
- [NoOrdinalsStringFieldDataTests » classMethod](https://gradle-enterprise.elastic.co/s/criyecvbvjcqy/tests/:server:test/org.elasticsearch.index.fielddata.NoOrdinalsStringFieldDataTests)
- [SortedSetDVStringFieldDataTests » classMethod](https://gradle-enterprise.elastic.co/s/criyecvbvjcqy/tests/:server:test/org.elasticsearch.index.fielddata.SortedSetDVStringFieldDataTests)
- [SortedSetDVStringFieldDataTests » classMethod](https://gradle-enterprise.elastic.co/s/criyecvbvjcqy/tests/:server:test/org.elasticsearch.index.fielddata.SortedSetDVStringFieldDataTests)
- [PagedBytesStringFieldDataTests » classMethod](https://gradle-enterprise.elastic.co/s/criyecvbvjcqy/tests/:server:test/org.elasticsearch.index.fielddata.PagedBytesStringFieldDataTests)
- [PagedBytesStringFieldDataTests » classMethod](https://gradle-enterprise.elastic.co/s/criyecvbvjcqy/tests/:server:test/org.elasticsearch.index.fielddata.PagedBytesStringFieldDataTests)

**Build scan:**
https://gradle-enterprise.elastic.co/s/criyecvbvjcqy/tests/:server:test/org.elasticsearch.index.fielddata.NoOrdinalsStringFieldDataTests

**Reproduction line:**
```
./gradlew ':server:test' --tests "org.elasticsearch.index.fielddata.NoOrdinalsStringFieldDataTests" -Dtests.seed=6970E66CD7B23E6C -Dtests.locale=en-US -Dtests.timezone=Etc/UTC -Druntime.java=20
```

**Applicable branches:**
main

**Reproduces locally?:**
Yes

**Failure history:**
https://gradle-enterprise.elastic.co/scans/tests?tests.container=org.elasticsearch.index.fielddata.NoOrdinalsStringFieldDataTests&tests.test=classMethod

**Failure excerpt:**
```
com.carrotsearch.randomizedtesting.ThreadLeakError: 2 threads leaked from SUITE scope at org.elasticsearch.index.fielddata.NoOrdinalsStringFieldDataTests: 
   1) Thread[id=499, name=LuceneTestCase-44-thread-2, state=WAITING, group=TGRP-NoOrdinalsStringFieldDataTests]
        at java.base/jdk.internal.misc.Unsafe.park(Native Method)
        at java.base/java.util.concurrent.locks.LockSupport.park(LockSupport.java:371)
        at java.base/java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionNode.block(AbstractQueuedSynchronizer.java:519)
        at java.base/java.util.concurrent.ForkJoinPool.unmanagedBlock(ForkJoinPool.java:3780)
        at java.base/java.util.concurrent.ForkJoinPool.managedBlock(ForkJoinPool.java:3725)
        at java.base/java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:1707)
        at java.base/java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:435)
        at java.base/java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1070)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
        at java.base/java.lang.Thread.run(Thread.java:1623)
   2) Thread[id=498, name=LuceneTestCase-44-thread-1, state=WAITING, group=TGRP-NoOrdinalsStringFieldDataTests]
        at java.base/jdk.internal.misc.Unsafe.park(Native Method)
        at java.base/java.util.concurrent.locks.LockSupport.park(LockSupport.java:371)
        at java.base/java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionNode.block(AbstractQueuedSynchronizer.java:519)
        at java.base/java.util.concurrent.ForkJoinPool.unmanagedBlock(ForkJoinPool.java:3780)
        at java.base/java.util.concurrent.ForkJoinPool.managedBlock(ForkJoinPool.java:3725)
        at java.base/java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:1707)
        at java.base/java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:435)
        at java.base/java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1070)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
        at java.base/java.lang.Thread.run(Thread.java:1623)

  at __randomizedtesting.SeedInfo.seed([6970E66CD7B23E6C]:0)

```
server/src/test/java/org/elasticsearch/index/fielddata/AbstractStringFieldDataTestCase.java
final int docID = topDocs.scoreDocs[i].doc;
            assertTrue("expected " + docID + " to be a parent", parents.get(docID));
            BytesRef cmpValue = null;
            for (int child = parents.prevSetBit(docID - 1) + 1; child < docID; ++child) {
                String[] sVals = searcher.doc(child).getValues("text");
                final BytesRef[] vals;
                if (sVals.length == 0) {
                    vals = new BytesRef[0];
                } else {
                    vals = new BytesRef[sVals.length];
                    for (int j = 0; j < vals.length; ++j) {
                        vals[j] = new BytesRef(sVals[j]);
                    }
                }
                for (BytesRef value : vals) {
                    if (cmpValue == null) {
                        cmpValue = value;
                    } else if (sortMode == MultiValueMode.MIN && value.compareTo(cmpValue) < 0) {
                        cmpValue = value;
                    } else if (sortMode == MultiValueMode.MAX && value.compareTo(cmpValue) > 0) {
                        cmpValue = value;
                    }
                }
            }
            if (cmpValue == null) {
                if ("_first".equals(missingValue)) {
                    cmpValue = new BytesRef();
                } else if ("_last".equals(missingValue) == false) {
                    cmpValue = (BytesRef) missingValue;
                }