**Build scan:**
https://gradle-enterprise.elastic.co/s/5a257lvuesvca/tests/:qa:multi-cluster-search:v8.8.0%23multi-cluster/org.elasticsearch.search.CCSDuelIT/testTermsLookup

**Reproduction line:**
```
./gradlew ':qa:multi-cluster-search:v8.8.0#multi-cluster' -Dtests.class="org.elasticsearch.search.CCSDuelIT" -Dtests.method="testTermsLookup" -Dtests.seed=749CFADD9B578FC -Dtests.bwc=true -Dtests.locale=ga -Dtests.timezone=Asia/Chita -Druntime.java=18
```

**Applicable branches:**
main

**Reproduces locally?:**
Didn't try

**Failure history:**
https://gradle-enterprise.elastic.co/scans/tests?tests.container=org.elasticsearch.search.CCSDuelIT&tests.test=testTermsLookup

**Failure excerpt:**
```
java.lang.AssertionError: both requests returned an exception

  at __randomizedtesting.SeedInfo.seed([749CFADD9B578FC:C6DBFF4B6CBA29C6]:0)
  at org.elasticsearch.search.CCSDuelIT.duelSearch(CCSDuelIT.java:782)
  at org.elasticsearch.search.CCSDuelIT.testTermsLookup(CCSDuelIT.java:668)
  at jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
  at java.lang.reflect.Method.invoke(Method.java:577)
  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:833)

  Caused by: org.elasticsearch.ElasticsearchStatusException: Elasticsearch exception [type=connect_transport_exception, reason=[][[::1]:37153] connect_exception]

    at org.elasticsearch.rest.RestResponse.errorFromXContent(RestResponse.java:213)
    at org.elasticsearch.client.RestHighLevelClient.parseEntity(RestHighLevelClient.java:642)
    at org.elasticsearch.client.RestHighLevelClient.parseResponseException(RestHighLevelClient.java:619)
    at org.elasticsearch.client.RestHighLevelClient$1.onFailure(RestHighLevelClient.java:593)
    at org.elasticsearch.client.RestClient$FailureTrackingResponseListener.onDefinitiveFailure(RestClient.java:684)
    at org.elasticsearch.client.RestClient$1.completed(RestClient.java:409)
    at org.elasticsearch.client.RestClient$1.completed(RestClient.java:393)
    at org.apache.http.concurrent.BasicFuture.completed(BasicFuture.java:122)
    at org.apache.http.impl.nio.client.DefaultClientExchangeHandlerImpl.responseCompleted(DefaultClientExchangeHandlerImpl.java:182)
    at org.apache.http.nio.protocol.HttpAsyncRequestExecutor.processResponse(HttpAsyncRequestExecutor.java:448)
    at org.apache.http.nio.protocol.HttpAsyncRequestExecutor.inputReady(HttpAsyncRequestExecutor.java:338)
    at org.apache.http.impl.nio.DefaultNHttpClientConnection.consumeInput(DefaultNHttpClientConnection.java:265)
    at org.apache.http.impl.nio.client.InternalIODispatch.onInputReady(InternalIODispatch.java:87)
    at org.apache.http.impl.nio.client.InternalIODispatch.onInputReady(InternalIODispatch.java:40)
    at org.apache.http.impl.nio.reactor.AbstractIODispatch.inputReady(AbstractIODispatch.java:114)
    at org.apache.http.impl.nio.reactor.BaseIOReactor.readable(BaseIOReactor.java:162)
    at org.apache.http.impl.nio.reactor.AbstractIOReactor.processEvent(AbstractIOReactor.java:337)
    at org.apache.http.impl.nio.reactor.AbstractIOReactor.processEvents(AbstractIOReactor.java:315)
    at org.apache.http.impl.nio.reactor.AbstractIOReactor.execute(AbstractIOReactor.java:276)
    at org.apache.http.impl.nio.reactor.BaseIOReactor.execute(BaseIOReactor.java:104)
    at org.apache.http.impl.nio.reactor.AbstractMultiworkerIOReactor$Worker.run(AbstractMultiworkerIOReactor.java:591)
    at java.lang.Thread.run(Thread.java:833)

    Caused by: org.elasticsearch.ElasticsearchException: Elasticsearch exception [type=uncategorized_execution_exception, reason=Failed execution]

      at org.elasticsearch.ElasticsearchException.innerFromXContent(ElasticsearchException.java:492)
      at org.elasticsearch.ElasticsearchException.fromXContent(ElasticsearchException.java:403)
      at org.elasticsearch.ElasticsearchException.innerFromXContent(ElasticsearchException.java:433)
      at org.elasticsearch.ElasticsearchException.failureFromXContent(ElasticsearchException.java:599)
      at org.elasticsearch.rest.RestResponse.errorFromXContent(RestResponse.java:205)
      at org.elasticsearch.client.RestHighLevelClient.parseEntity(RestHighLevelClient.java:642)
      at org.elasticsearch.client.RestHighLevelClient.parseResponseException(RestHighLevelClient.java:619)
      at org.elasticsearch.client.RestHighLevelClient$1.onFailure(RestHighLevelClient.java:593)
      at org.elasticsearch.client.RestClient$FailureTrackingResponseListener.onDefinitiveFailure(RestClient.java:684)
      at org.elasticsearch.client.RestClient$1.completed(RestClient.java:409)
      at org.elasticsearch.client.RestClient$1.completed(RestClient.java:393)
      at org.apache.http.concurrent.BasicFuture.completed(BasicFuture.java:122)
      at org.apache.http.impl.nio.client.DefaultClientExchangeHandlerImpl.responseCompleted(DefaultClientExchangeHandlerImpl.java:182)
      at org.apache.http.nio.protocol.HttpAsyncRequestExecutor.processResponse(HttpAsyncRequestExecutor.java:448)
      at org.apache.http.nio.protocol.HttpAsyncRequestExecutor.inputReady(HttpAsyncRequestExecutor.java:338)
      at org.apache.http.impl.nio.DefaultNHttpClientConnection.consumeInput(DefaultNHttpClientConnection.java:265)
      at org.apache.http.impl.nio.client.InternalIODispatch.onInputReady(InternalIODispatch.java:87)
      at org.apache.http.impl.nio.client.InternalIODispatch.onInputReady(InternalIODispatch.java:40)
      at org.apache.http.impl.nio.reactor.AbstractIODispatch.inputReady(AbstractIODispatch.java:114)
      at org.apache.http.impl.nio.reactor.BaseIOReactor.readable(BaseIOReactor.java:162)
      at org.apache.http.impl.nio.reactor.AbstractIOReactor.processEvent(AbstractIOReactor.java:337)
      at org.apache.http.impl.nio.reactor.AbstractIOReactor.processEvents(AbstractIOReactor.java:315)
      at org.apache.http.impl.nio.reactor.AbstractIOReactor.execute(AbstractIOReactor.java:276)
      at org.apache.http.impl.nio.reactor.BaseIOReactor.execute(BaseIOReactor.java:104)
      at org.apache.http.impl.nio.reactor.AbstractMultiworkerIOReactor$Worker.run(AbstractMultiworkerIOReactor.java:591)
      at java.lang.Thread.run(Thread.java:833)

      Caused by: org.elasticsearch.ElasticsearchException: Elasticsearch exception [type=execution_exception, reason=io.netty.channel.AbstractChannel$AnnotatedConnectException: Connection refused: /[0:0:0:0:0:0:0:1]:37153]

        at org.elasticsearch.ElasticsearchException.innerFromXContent(ElasticsearchException.java:492)
        at org.elasticsearch.ElasticsearchException.fromXContent(ElasticsearchException.java:403)
        at org.elasticsearch.ElasticsearchException.innerFromXContent(ElasticsearchException.java:433)
        at org.elasticsearch.ElasticsearchException.fromXContent(ElasticsearchException.java:403)
        at org.elasticsearch.ElasticsearchException.innerFromXContent(ElasticsearchException.java:433)
        at org.elasticsearch.ElasticsearchException.failureFromXContent(ElasticsearchException.java:599)
        at org.elasticsearch.rest.RestResponse.errorFromXContent(RestResponse.java:205)
        at org.elasticsearch.client.RestHighLevelClient.parseEntity(RestHighLevelClient.java:642)
        at org.elasticsearch.client.RestHighLevelClient.parseResponseException(RestHighLevelClient.java:619)
        at org.elasticsearch.client.RestHighLevelClient$1.onFailure(RestHighLevelClient.java:593)
        at org.elasticsearch.client.RestClient$FailureTrackingResponseListener.onDefinitiveFailure(RestClient.java:684)
        at org.elasticsearch.client.RestClient$1.completed(RestClient.java:409)
        at org.elasticsearch.client.RestClient$1.completed(RestClient.java:393)
        at org.apache.http.concurrent.BasicFuture.completed(BasicFuture.java:122)
        at org.apache.http.impl.nio.client.DefaultClientExchangeHandlerImpl.responseCompleted(DefaultClientExchangeHandlerImpl.java:182)
        at org.apache.http.nio.protocol.HttpAsyncRequestExecutor.processResponse(HttpAsyncRequestExecutor.java:448)
        at org.apache.http.nio.protocol.HttpAsyncRequestExecutor.inputReady(HttpAsyncRequestExecutor.java:338)
        at org.apache.http.impl.nio.DefaultNHttpClientConnection.consumeInput(DefaultNHttpClientConnection.java:265)
        at org.apache.http.impl.nio.client.InternalIODispatch.onInputReady(InternalIODispatch.java:87)
        at org.apache.http.impl.nio.client.InternalIODispatch.onInputReady(InternalIODispatch.java:40)
        at org.apache.http.impl.nio.reactor.AbstractIODispatch.inputReady(AbstractIODispatch.java:114)
        at org.apache.http.impl.nio.reactor.BaseIOReactor.readable(BaseIOReactor.java:162)
        at org.apache.http.impl.nio.reactor.AbstractIOReactor.processEvent(AbstractIOReactor.java:337)
        at org.apache.http.impl.nio.reactor.AbstractIOReactor.processEvents(AbstractIOReactor.java:315)
        at org.apache.http.impl.nio.reactor.AbstractIOReactor.execute(AbstractIOReactor.java:276)
        at org.apache.http.impl.nio.reactor.BaseIOReactor.execute(BaseIOReactor.java:104)
        at org.apache.http.impl.nio.reactor.AbstractMultiworkerIOReactor$Worker.run(AbstractMultiworkerIOReactor.java:591)
        at java.lang.Thread.run(Thread.java:833)

        Caused by: org.elasticsearch.ElasticsearchException: Elasticsearch exception [type=annotated_connect_exception, reason=Connection refused: /[0:0:0:0:0:0:0:1]:37153]

          at org.elasticsearch.ElasticsearchException.innerFromXContent(ElasticsearchException.java:492)
          at org.elasticsearch.ElasticsearchException.fromXContent(ElasticsearchException.java:403)
          at org.elasticsearch.ElasticsearchException.innerFromXContent(ElasticsearchException.java:433)
          at org.elasticsearch.ElasticsearchException.fromXContent(ElasticsearchException.java:403)
          at org.elasticsearch.ElasticsearchException.innerFromXContent(ElasticsearchException.java:433)
          at org.elasticsearch.ElasticsearchException.fromXContent(ElasticsearchException.java:403)
          at org.elasticsearch.ElasticsearchException.innerFromXContent(ElasticsearchException.java:433)
          at org.elasticsearch.ElasticsearchException.failureFromXContent(ElasticsearchException.java:599)
          at org.elasticsearch.rest.RestResponse.errorFromXContent(RestResponse.java:205)
          at org.elasticsearch.client.RestHighLevelClient.parseEntity(RestHighLevelClient.java:642)
          at org.elasticsearch.client.RestHighLevelClient.parseResponseException(RestHighLevelClient.java:619)
          at org.elasticsearch.client.RestHighLevelClient$1.onFailure(RestHighLevelClient.java:593)
          at org.elasticsearch.client.RestClient$FailureTrackingResponseListener.onDefinitiveFailure(RestClient.java:684)
          at org.elasticsearch.client.RestClient$1.completed(RestClient.java:409)
          at org.elasticsearch.client.RestClient$1.completed(RestClient.java:393)
          at org.apache.http.concurrent.BasicFuture.completed(BasicFuture.java:122)
          at org.apache.http.impl.nio.client.DefaultClientExchangeHandlerImpl.responseCompleted(DefaultClientExchangeHandlerImpl.java:182)
          at org.apache.http.nio.protocol.HttpAsyncRequestExecutor.processResponse(HttpAsyncRequestExecutor.java:448)
          at org.apache.http.nio.protocol.HttpAsyncRequestExecutor.inputReady(HttpAsyncRequestExecutor.java:338)
          at org.apache.http.impl.nio.DefaultNHttpClientConnection.consumeInput(DefaultNHttpClientConnection.java:265)
          at org.apache.http.impl.nio.client.InternalIODispatch.onInputReady(InternalIODispatch.java:87)
          at org.apache.http.impl.nio.client.InternalIODispatch.onInputReady(InternalIODispatch.java:40)
          at org.apache.http.impl.nio.reactor.AbstractIODispatch.inputReady(AbstractIODispatch.java:114)
          at org.apache.http.impl.nio.reactor.BaseIOReactor.readable(BaseIOReactor.java:162)
          at org.apache.http.impl.nio.reactor.AbstractIOReactor.processEvent(AbstractIOReactor.java:337)
          at org.apache.http.impl.nio.reactor.AbstractIOReactor.processEvents(AbstractIOReactor.java:315)
          at org.apache.http.impl.nio.reactor.AbstractIOReactor.execute(AbstractIOReactor.java:276)
          at org.apache.http.impl.nio.reactor.BaseIOReactor.execute(BaseIOReactor.java:104)
          at org.apache.http.impl.nio.reactor.AbstractMultiworkerIOReactor$Worker.run(AbstractMultiworkerIOReactor.java:591)
          at java.lang.Thread.run(Thread.java:833)

          Caused by: org.elasticsearch.ElasticsearchException: Elasticsearch exception [type=connect_exception, reason=Connection refused]

            at org.elasticsearch.ElasticsearchException.innerFromXContent(ElasticsearchException.java:492)
            at org.elasticsearch.ElasticsearchException.fromXContent(ElasticsearchException.java:403)
            at org.elasticsearch.ElasticsearchException.innerFromXContent(ElasticsearchException.java:433)
            at org.elasticsearch.ElasticsearchException.fromXContent(ElasticsearchException.java:403)
            at org.elasticsearch.ElasticsearchException.innerFromXContent(ElasticsearchException.java:433)
            at org.elasticsearch.ElasticsearchException.fromXContent(ElasticsearchException.java:403)
            at org.elasticsearch.ElasticsearchException.innerFromXContent(ElasticsearchException.java:433)
            at org.elasticsearch.ElasticsearchException.fromXContent(ElasticsearchException.java:403)
            at org.elasticsearch.ElasticsearchException.innerFromXContent(ElasticsearchException.java:433)
            at org.elasticsearch.ElasticsearchException.failureFromXContent(ElasticsearchException.java:599)
            at org.elasticsearch.rest.RestResponse.errorFromXContent(RestResponse.java:205)
            at org.elasticsearch.client.RestHighLevelClient.parseEntity(RestHighLevelClient.java:642)
            at org.elasticsearch.client.RestHighLevelClient.parseResponseException(RestHighLevelClient.java:619)
            at org.elasticsearch.client.RestHighLevelClient$1.onFailure(RestHighLevelClient.java:593)
            at org.elasticsearch.client.RestClient$FailureTrackingResponseListener.onDefinitiveFailure(RestClient.java:684)
            at org.elasticsearch.client.RestClient$1.completed(RestClient.java:409)
            at org.elasticsearch.client.RestClient$1.completed(RestClient.java:393)
            at org.apache.http.concurrent.BasicFuture.completed(BasicFuture.java:122)
            at org.apache.http.impl.nio.client.DefaultClientExchangeHandlerImpl.responseCompleted(DefaultClientExchangeHandlerImpl.java:182)
            at org.apache.http.nio.protocol.HttpAsyncRequestExecutor.processResponse(HttpAsyncRequestExecutor.java:448)
            at org.apache.http.nio.protocol.HttpAsyncRequestExecutor.inputReady(HttpAsyncRequestExecutor.java:338)
            at org.apache.http.impl.nio.DefaultNHttpClientConnection.consumeInput(DefaultNHttpClientConnection.java:265)
            at org.apache.http.impl.nio.client.InternalIODispatch.onInputReady(InternalIODispatch.java:87)
            at org.apache.http.impl.nio.client.InternalIODispatch.onInputReady(InternalIODispatch.java:40)
            at org.apache.http.impl.nio.reactor.AbstractIODispatch.inputReady(AbstractIODispatch.java:114)
            at org.apache.http.impl.nio.reactor.BaseIOReactor.readable(BaseIOReactor.java:162)
            at org.apache.http.impl.nio.reactor.AbstractIOReactor.processEvent(AbstractIOReactor.java:337)
            at org.apache.http.impl.nio.reactor.AbstractIOReactor.processEvents(AbstractIOReactor.java:315)
            at org.apache.http.impl.nio.reactor.AbstractIOReactor.execute(AbstractIOReactor.java:276)
            at org.apache.http.impl.nio.reactor.BaseIOReactor.execute(BaseIOReactor.java:104)
            at org.apache.http.impl.nio.reactor.AbstractMultiworkerIOReactor$Worker.run(AbstractMultiworkerIOReactor.java:591)
            at java.lang.Thread.run(Thread.java:833)

```
server/src/main/java/org/elasticsearch/transport/TransportActionProxy.java
/**
     * Unwraps a proxy request and returns the original request
     */
    public static TransportRequest unwrapRequest(TransportRequest request) {
        if (request instanceof ProxyRequest) {
            return ((ProxyRequest<?>) request).wrapped;
        }
        return request;
    }
    /**
     * Unwraps a proxy action and returns the underlying action
     */
    public static String unwrapAction(String action) {
        assert isProxyAction(action) : "Attempted to unwrap non-proxy action: " + action;
        return action.substring(PROXY_ACTION_PREFIX.length());
    }
    /**
     * Returns <code>true</code> iff the given action is a proxy action
     */
    public static boolean isProxyAction(String action) {
        return action.startsWith(PROXY_ACTION_PREFIX);
    }
    /**
     * Returns <code>true</code> iff the given request is a proxy request
     */
    public static boolean isProxyRequest(TransportRequest request) {
        return request instanceof ProxyRequest;
    }
}