### Elasticsearch Version

8.3.0

### Installed Plugins

_No response_

### Java Version

_bundled_

### OS Version

arm64

### Problem Description

When using the `_terms_enum` API, if remote clusters return failures, but the local cluster doesn't, a null exception is thrown:

```
{
  "error": {
    "root_cause": [
      {
        "type": "null_pointer_exception",
        "reason": "Cannot invoke \"java.util.List.add(Object)\" because \"shardFailures\" is null"
      }
    ],
    "type": "null_pointer_exception",
    "reason": "Cannot invoke \"java.util.List.add(Object)\" because \"shardFailures\" is null"
  },
  "status": 500
}
```

### Steps to Reproduce

Call the _terms_enum API with a remote cluster that will return failures, e.g. because of this bug: https://github.com/elastic/elasticsearch/issues/86187

### Logs (if relevant)

_No response_
x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/termsenum/action/TransportTermsEnumAction.java
ThreadContext threadContext = transportService.getThreadPool().getThreadContext();
        final XPackLicenseState frozenLicenseState = licenseState.copyCurrentLicenseState();
        for (ShardId shardId : request.shardIds().toArray(new ShardId[0])) {
            if (canAccess(shardId, request, frozenLicenseState, threadContext) == false || canMatchShard(shardId, request) == false) {
                
                request.remove(shardId);
            }
        }
        if (request.shardIds().size() == 0) {
            listener.onResponse(new NodeTermsEnumResponse(request.nodeId(), Collections.emptyList(), null, true));
        } else {
            
            assert transportService.getThreadPool().executor(ThreadPool.Names.SEARCH) instanceof EsThreadPoolExecutor
                : "SEARCH threadpool must be an instance of ThreadPoolExecutor";
            EsThreadPoolExecutor ex = (EsThreadPoolExecutor) transportService.getThreadPool().executor(ThreadPool.Names.SEARCH);
            final String executorName = ex.getQueue().size() == 0 ? ThreadPool.Names.SEARCH : shardExecutor;
            transportService.getThreadPool()
                .executor(executorName)
                .execute(ActionRunnable.supply(listener, () -> dataNodeOperation(request, task)));
        }
    }
    private static class RemoteClusterTermsEnumResponse {
        final String clusterAlias;
        final TermsEnumResponse resp;
        private RemoteClusterTermsEnumResponse(String clusterAlias, TermsEnumResponse resp) {
            this.clusterAlias = clusterAlias;
            this.resp = resp;
        }
    }
    private static class TermIterator implements Iterator<String>, Comparable<TermIterator> {