### CI Link

https://gradle-enterprise.elastic.co/s/jm23mm5adnb7k

### Repro line

```
./gradlew ':x-pack:plugin:searchable-snapshots:qa:hdfs:javaRestTest' --tests "org.elasticsearch.xpack.searchablesnapshots.hdfs.HdfsSearchableSnapshotsIT.testClearCache" -Dtests.seed=D7B1B85A4D520CDE -Dtests.locale=es-ES -Dtests.timezone=Atlantic/Azores -Druntime.java=18
```

### Does it reproduce?

No

### Applicable branches

7.17

### Failure history

_No response_

### Failure excerpt
```
org.elasticsearch.xpack.searchablesnapshots.hdfs.HdfsSearchableSnapshotsIT > testClearCache FAILED
    java.lang.AssertionError: 
    Expected: <49736L>
         but: was <49752L>
        at __randomizedtesting.SeedInfo.seed([D7B1B85A4D520CDE:196E8296CFC1439E]: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.xpack.searchablesnapshots.AbstractSearchableSnapshotsRestTestCase.lambda$testClearCache$19(AbstractSearchableSnapshotsRestTestCase.java:365)
        at org.elasticsearch.xpack.searchablesnapshots.AbstractSearchableSnapshotsRestTestCase.runSearchableSnapshotsTest(AbstractSearchableSnapshotsRestTestCase.java:229)
        at org.elasticsearch.xpack.searchablesnapshots.AbstractSearchableSnapshotsRestTestCase.runSearchableSnapshotsTest(AbstractSearchableSnapshotsRestTestCase.java:91)
        at org.elasticsearch.xpack.searchablesnapshots.AbstractSearchableSnapshotsRestTestCase.runSearchableSnapshotsTest(AbstractSearchableSnapshotsRestTestCase.java:87)
        at org.elasticsearch.xpack.searchablesnapshots.AbstractSearchableSnapshotsRestTestCase.testClearCache(AbstractSearchableSnapshotsRestTestCase.java:352)
        at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
        at java.base/java.lang.reflect.Method.invoke(Method.java:577)
        at com.carrotsearch.randomizedtesting.RandomizedRunner.invoke(RandomizedRunner.java:1750)
        at com.carrotsearch.randomizedtesting.RandomizedRunner$8.evaluate(RandomizedRunner.java:938)
        at com.carrotsearch.randomizedtesting.RandomizedRunner$9.evaluate(RandomizedRunner.java:974)
        at com.carrotsearch.randomizedtesting.RandomizedRunner$10.evaluate(RandomizedRunner.java:988)
        at com.carrotsearch.randomizedtesting.rules.StatementAdapter.evaluate(StatementAdapter.java:36)
        at org.apache.lucene.util.TestRuleSetupTeardownChained$1.evaluate(TestRuleSetupTeardownChained.java:49)
        at org.apache.lucene.util.AbstractBeforeAfterRule$1.evaluate(AbstractBeforeAfterRule.java:45)
        at org.apache.lucene.util.TestRuleThreadAndTestName$1.evaluate(TestRuleThreadAndTestName.java:48)
        at org.apache.lucene.util.TestRuleIgnoreAfterMaxFailures$1.evaluate(TestRuleIgnoreAfterMaxFailures.java:64)
        at org.apache.lucene.util.TestRuleMarkFailure$1.evaluate(TestRuleMarkFailure.java:47)
        at com.carrotsearch.randomizedtesting.rules.StatementAdapter.evaluate(StatementAdapter.java:36)
        at com.carrotsearch.randomizedtesting.ThreadLeakControl$StatementRunner.run(ThreadLeakControl.java:368)
        at com.carrotsearch.randomizedtesting.ThreadLeakControl.forkTimeoutingTask(ThreadLeakControl.java:817)
        at com.carrotsearch.randomizedtesting.ThreadLeakControl$3.evaluate(ThreadLeakControl.java:468)
        at com.carrotsearch.randomizedtesting.RandomizedRunner.runSingleTest(RandomizedRunner.java:947)
        at com.carrotsearch.randomizedtesting.RandomizedRunner$5.evaluate(RandomizedRunner.java:832)
        at com.carrotsearch.randomizedtesting.RandomizedRunner$6.evaluate(RandomizedRunner.java:883)
        at com.carrotsearch.randomizedtesting.RandomizedRunner$7.evaluate(RandomizedRunner.java:894)
        at org.apache.lucene.util.AbstractBeforeAfterRule$1.evaluate(AbstractBeforeAfterRule.java:45)
        at com.carrotsearch.randomizedtesting.rules.StatementAdapter.evaluate(StatementAdapter.java:36)
        at org.apache.lucene.util.TestRuleStoreClassName$1.evaluate(TestRuleStoreClassName.java:41)
        at com.carrotsearch.randomizedtesting.rules.NoShadowingOrOverridesOnMethodsRule$1.evaluate(NoShadowingOrOverridesOnMethodsRule.java:40)
        at com.carrotsearch.randomizedtesting.rules.NoShadowingOrOverridesOnMethodsRule$1.evaluate(NoShadowingOrOverridesOnMethodsRule.java:40)
        at com.carrotsearch.randomizedtesting.rules.StatementAdapter.evaluate(StatementAdapter.java:36)
        at com.carrotsearch.randomizedtesting.rules.StatementAdapter.evaluate(StatementAdapter.java:36)
        at org.apache.lucene.util.TestRuleAssertionsRequired$1.evaluate(TestRuleAssertionsRequired.java:53)
        at org.apache.lucene.util.TestRuleMarkFailure$1.evaluate(TestRuleMarkFailure.java:47)
        at org.apache.lucene.util.TestRuleIgnoreAfterMaxFailures$1.evaluate(TestRuleIgnoreAfterMaxFailures.java:64)
        at org.apache.lucene.util.TestRuleIgnoreTestSuites$1.evaluate(TestRuleIgnoreTestSuites.java:54)
        at com.carrotsearch.randomizedtesting.rules.StatementAdapter.evaluate(StatementAdapter.java:36)
        at com.carrotsearch.randomizedtesting.ThreadLeakControl$StatementRunner.run(ThreadLeakControl.java:368)
        at java.base/java.lang.Thread.run(Thread.java:833)
```        
x-pack/plugin/searchable-snapshots/src/test/java/org/elasticsearch/xpack/searchablesnapshots/AbstractSearchableSnapshotsRestTestCase.java
var thread = new Thread(() -> {
                try {
                    do {
                        final StringBuilder bulkBody = new StringBuilder();
                        int bulkSize = 0;
                        long n;
                        while ((n = remainingDocs.decrementAndGet()) >= 0) {
                            bulkBody.append(String.format(Locale.ROOT, """
                                    {"index": {"_id":"%d"} }
                                    {"field": %d, "text": "Document number %d"}
                                """, n, n, n));
                            bulkSize += 1;
                            if (bulkSize >= 500) {
                                break;
                            }
                        }
                        if (bulkSize > 0) {
                            Request documents = new Request(HttpPost.METHOD_NAME, '/' + indexName + "/_bulk");
                            documents.addParameter("refresh", Boolean.TRUE.toString());
                            documents.setJsonEntity(bulkBody.toString());
                            assertOK(client().performRequest(documents));
                        }
                    } while (remainingDocs.get() > 0);
                } catch (Exception e) {
                    throw new AssertionError(e);
                } finally {
                    indexingLatch.countDown();
                }
            });
            thread.start();