**Build scan:**
https://gradle-enterprise.elastic.co/s/7qe3jde27dcuu/tests/:qa:rolling-upgrade-legacy:v7.17.13%23upgradedClusterTest/org.elasticsearch.upgrades.RecoveryIT/testRecoveryWithConcurrentIndexing

**Reproduction line:**
```
./gradlew ':qa:rolling-upgrade-legacy:v7.17.13#upgradedClusterTest' -Dtests.class="org.elasticsearch.upgrades.RecoveryIT" -Dtests.method="testRecoveryWithConcurrentIndexing" -Dtests.seed=DD0C8780632E495C -Dtests.bwc=true -Dtests.locale=sq -Dtests.timezone=Europe/Kiev -Druntime.java=20
```

**Applicable branches:**
main

**Reproduces locally?:**
No

**Failure history:**
https://gradle-enterprise.elastic.co/scans/tests?tests.container=org.elasticsearch.upgrades.RecoveryIT&tests.test=testRecoveryWithConcurrentIndexing

**Failure excerpt:**
```
java.lang.AssertionError: failed to get doc count for index [recovery_with_concurrent_indexing] with preference [_only_nodes:GIsX4jecSECR8Sukz4EWZg] response [org.elasticsearch.client.ResponseException: method [GET], host [http://127.0.0.1:38683], URI [recovery_with_concurrent_indexing/_count?preference=_only_nodes%3AGIsX4jecSECR8Sukz4EWZg], status line [HTTP/1.1 400 Bad Request]
{"error":{"root_cause":[{"type":"illegal_argument_exception","reason":"no data nodes with criteria [GIsX4jecSECR8Sukz4EWZg] found for shard: [recovery_with_concurrent_indexing][0]"}],"type":"illegal_argument_exception","reason":"no data nodes with criteria [GIsX4jecSECR8Sukz4EWZg] found for shard: [recovery_with_concurrent_indexing][0]"},"status":400}] recovery [{"recovery_with_concurrent_indexing":{"shards":[{"id":0,"type":"PEER","stage":"DONE","primary":false,"start_time_in_millis":1695316186643,"stop_time_in_millis":1695316186855,"total_time_in_millis":212,"source":{"id":"SymbfPsORgWRLdlBANBhkQ","host":"127.0.0.1","transport_address":"127.0.0.1:35819","ip":"127.0.0.1","name":"v7.17.13-0"},"target":{"id":"QcuazfWtSq2Chj-mCEaa9w","host":"127.0.0.1","transport_address":"127.0.0.1:38307","ip":"127.0.0.1","name":"v7.17.13-1"},"index":{"size":{"total_in_bytes":0,"reused_in_bytes":0,"recovered_in_bytes":0,"recovered_from_snapshot_in_bytes":0,"percent":"0.0%"},"files":{"total":0,"reused":0,"recovered":0,"percent":"0.0%"},"total_time_in_millis":0,"source_throttle_time_in_millis":0,"target_throttle_time_in_millis":0},"translog":{"recovered":65,"total":67,"percent":"97.0%","total_on_start":-1,"total_time_in_millis":168},"verify_index":{"check_index_time_in_millis":0,"total_time_in_millis":0}},{"id":0,"type":"PEER","stage":"DONE","primary":false,"start_time_in_millis":1695316051628,"stop_time_in_millis":1695316051692,"total_time_in_millis":64,"source":{"id":"QcuazfWtSq2Chj-mCEaa9w","host":"127.0.0.1","transport_address":"127.0.0.1:35397","ip":"127.0.0.1","name":"v7.17.13-1"},"target":{"id":"SymbfPsORgWRLdlBANBhkQ","host":"127.0.0.1","transport_address":"127.0.0.1:35819","ip":"127.0.0.1","name":"v7.17.13-0"},"index":{"size":{"total_in_bytes":0,"reused_in_bytes":0,"recovered_in_bytes":0,"recovered_from_snapshot_in_bytes":0,"percent":"0.0%"},"files":{"total":0,"reused":0,"recovered":0,"percent":"0.0%"},"total_time_in_millis":0,"source_throttle_time_in_millis":0,"target_throttle_time_in_millis":0},"translog":{"recovered":11,"total":11,"percent":"100.0%","total_on_start":-1,"total_time_in_millis":59},"verify_index":{"check_index_time_in_millis":0,"total_time_in_millis":0}}]}}]

  at __randomizedtesting.SeedInfo.seed([DD0C8780632E495C:5D5D43D3E18A9796]:0)
  at org.junit.Assert.fail(Assert.java:88)
  at org.elasticsearch.upgrades.RecoveryIT.assertCount(RecoveryIT.java:181)
  at org.elasticsearch.upgrades.RecoveryIT.testRecoveryWithConcurrentIndexing(RecoveryIT.java:161)
  at jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
  at java.lang.reflect.Method.invoke(Method.java:578)
  at com.carrotsearch.randomizedtesting.RandomizedRunner.invoke(RandomizedRunner.java:1758)
  at com.carrotsearch.randomizedtesting.RandomizedRunner$8.evaluate(RandomizedRunner.java:946)
  at com.carrotsearch.randomizedtesting.RandomizedRunner$9.evaluate(RandomizedRunner.java:982)
  at com.carrotsearch.randomizedtesting.RandomizedRunner$10.evaluate(RandomizedRunner.java:996)
  at com.carrotsearch.randomizedtesting.rules.StatementAdapter.evaluate(StatementAdapter.java:36)
  at org.apache.lucene.tests.util.TestRuleSetupTeardownChained$1.evaluate(TestRuleSetupTeardownChained.java:48)
  at org.apache.lucene.tests.util.AbstractBeforeAfterRule$1.evaluate(AbstractBeforeAfterRule.java:43)
  at org.apache.lucene.tests.util.TestRuleThreadAndTestName$1.evaluate(TestRuleThreadAndTestName.java:45)
  at org.apache.lucene.tests.util.TestRuleIgnoreAfterMaxFailures$1.evaluate(TestRuleIgnoreAfterMaxFailures.java:60)
  at org.apache.lucene.tests.util.TestRuleMarkFailure$1.evaluate(TestRuleMarkFailure.java:44)
  at com.carrotsearch.randomizedtesting.rules.StatementAdapter.evaluate(StatementAdapter.java:36)
  at com.carrotsearch.randomizedtesting.ThreadLeakControl$StatementRunner.run(ThreadLeakControl.java:390)
  at com.carrotsearch.randomizedtesting.ThreadLeakControl.forkTimeoutingTask(ThreadLeakControl.java:843)
  at com.carrotsearch.randomizedtesting.ThreadLeakControl$3.evaluate(ThreadLeakControl.java:490)
  at com.carrotsearch.randomizedtesting.RandomizedRunner.runSingleTest(RandomizedRunner.java:955)
  at com.carrotsearch.randomizedtesting.RandomizedRunner$5.evaluate(RandomizedRunner.java:840)
  at com.carrotsearch.randomizedtesting.RandomizedRunner$6.evaluate(RandomizedRunner.java:891)
  at com.carrotsearch.randomizedtesting.RandomizedRunner$7.evaluate(RandomizedRunner.java:902)
  at org.apache.lucene.tests.util.AbstractBeforeAfterRule$1.evaluate(AbstractBeforeAfterRule.java:43)
  at com.carrotsearch.randomizedtesting.rules.StatementAdapter.evaluate(StatementAdapter.java:36)
  at org.apache.lucene.tests.util.TestRuleStoreClassName$1.evaluate(TestRuleStoreClassName.java:38)
  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.tests.util.TestRuleAssertionsRequired$1.evaluate(TestRuleAssertionsRequired.java:53)
  at org.apache.lucene.tests.util.AbstractBeforeAfterRule$1.evaluate(AbstractBeforeAfterRule.java:43)
  at org.apache.lucene.tests.util.TestRuleMarkFailure$1.evaluate(TestRuleMarkFailure.java:44)
  at org.apache.lucene.tests.util.TestRuleIgnoreAfterMaxFailures$1.evaluate(TestRuleIgnoreAfterMaxFailures.java:60)
  at org.apache.lucene.tests.util.TestRuleIgnoreTestSuites$1.evaluate(TestRuleIgnoreTestSuites.java:47)
  at com.carrotsearch.randomizedtesting.rules.StatementAdapter.evaluate(StatementAdapter.java:36)
  at com.carrotsearch.randomizedtesting.ThreadLeakControl$StatementRunner.run(ThreadLeakControl.java:390)
  at com.carrotsearch.randomizedtesting.ThreadLeakControl.lambda$forkTimeoutingTask$0(ThreadLeakControl.java:850)
  at java.lang.Thread.run(Thread.java:1623)

```
qa/rolling-upgrade-legacy/src/test/java/org/elasticsearch/upgrades/RecoveryIT.java
assertBusy(() -> {
                    Map<String, ?> state = entityAsMap(client().performRequest(new Request("GET", "/_cluster/state")));
                    String xpath = "routing_table.indices." + index + ".shards.0.node";
                    @SuppressWarnings("unchecked")
                    List<String> assignedNodes = (List<String>) XContentMapValues.extractValue(xpath, state);
                    assertNotNull(state.toString(), assignedNodes);
                    assertThat(state.toString(), newNode, in(assignedNodes));
                }, 60, TimeUnit.SECONDS);
                ensureGreen(index);
                client().performRequest(new Request("POST", index + "/_refresh"));
                assertCount(index, "_only_nodes:" + newNode, 60);
            }
            case UPGRADED -> {
                updateIndexSettings(
                    index,
                    Settings.builder()
                        .put(IndexMetadata.INDEX_NUMBER_OF_REPLICAS_SETTING.getKey(), 2)
                        .put("index.routing.allocation.include._id", (String) null)
                        .putNull("index.routing.allocation.include._tier_preference")
                );
                asyncIndexDocs(index, 60, 45).get();
                ensureGreen(index);
                client().performRequest(new Request("POST", index + "/_refresh"));
                Response response = client().performRequest(new Request("GET", "_nodes"));
                ObjectPath objectPath = ObjectPath.createFromResponse(response);
                final Map<String, Object> nodeMap = objectPath.evaluate("nodes");
                List<String> nodes = new ArrayList<>(nodeMap.keySet());
                assertCount(index, "_only_nodes:" + nodes.get(0), 105);
                assertCount(index, "_only_nodes:" + nodes.get(1), 105);