When using the terms enum API on a constant keyword field, an error is returned complaining about a non-null value.

Request:

```
POST /metrics-endpoint.policy-default/_terms_enum
{
  "field": "data_stream.type"
}
```

Response:

```
#! Your license will expire in [5] days. Contact your administrator or update your license for continued use of features
#! Your license will expire in [6] days. Contact your administrator or update your license for continued use of features
{
  "_shards" : {
    "total" : 8,
    "successful" : 4,
    "failed" : 4,
    "failures" : [
      {
        "shard" : 0,
        "index" : ".ds-metrics-endpoint.policy-default-2022.04.04-000001",
        "status" : "INTERNAL_SERVER_ERROR",
        "reason" : {
          "type" : "broadcast_shard_operation_failed_exception",
          "reason" : """java.lang.NullPointerException: Cannot invoke "String.startsWith(String)" because "this.value" is null
	at org.elasticsearch.xpack.constantkeyword.mapper.ConstantKeywordFieldMapper$ConstantKeywordFieldType.getTerms(ConstantKeywordFieldMapper.java:156)
	at org.elasticsearch.xpack.core.termsenum.action.TransportTermsEnumAction.dataNodeOperation(TransportTermsEnumAction.java:351)
	at org.elasticsearch.xpack.core.termsenum.action.TransportTermsEnumAction.lambda$asyncNodeOperation$0(TransportTermsEnumAction.java:712)
	at org.elasticsearch.action.ActionRunnable.lambda$supply$0(ActionRunnable.java:47)
	at org.elasticsearch.action.ActionRunnable$2.doRun(ActionRunnable.java:62)
	at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:26)
	at org.elasticsearch.common.util.concurrent.TimedRunnable.doRun(TimedRunnable.java:33)
	at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(ThreadContext.java:773)
	at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:26)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
	at java.base/java.lang.Thread.run(Thread.java:833)
""",
          "index_uuid" : "uOdQ_uBRRLeq5-OAJAwGrg",
          "shard" : "0",
          "index" : ".ds-metrics-endpoint.policy-default-2022.04.04-000001"
        }
      },
      {
        "shard" : 0,
        "index" : ".ds-metrics-endpoint.policy-default-2022.04.07-000002",
        "status" : "INTERNAL_SERVER_ERROR",
        "reason" : {
          "type" : "broadcast_shard_operation_failed_exception",
          "reason" : """java.lang.NullPointerException: Cannot invoke "String.startsWith(String)" because "this.value" is null
	at org.elasticsearch.xpack.constantkeyword.mapper.ConstantKeywordFieldMapper$ConstantKeywordFieldType.getTerms(ConstantKeywordFieldMapper.java:156)
	at org.elasticsearch.xpack.core.termsenum.action.TransportTermsEnumAction.dataNodeOperation(TransportTermsEnumAction.java:351)
	at org.elasticsearch.xpack.core.termsenum.action.TransportTermsEnumAction.lambda$asyncNodeOperation$0(TransportTermsEnumAction.java:712)
	at org.elasticsearch.action.ActionRunnable.lambda$supply$0(ActionRunnable.java:47)
	at org.elasticsearch.action.ActionRunnable$2.doRun(ActionRunnable.java:62)
	at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:26)
	at org.elasticsearch.common.util.concurrent.TimedRunnable.doRun(TimedRunnable.java:33)
	at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(ThreadContext.java:773)
	at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:26)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
	at java.base/java.lang.Thread.run(Thread.java:833)
""",
          "index_uuid" : "qBOOM6CXRpuK0budYXBUnQ",
          "shard" : "0",
          "index" : ".ds-metrics-endpoint.policy-default-2022.04.07-000002"
        }
      },
      {
        "shard" : 0,
        "index" : ".ds-metrics-endpoint.policy-default-2022.04.22-000007",
        "status" : "INTERNAL_SERVER_ERROR",
        "reason" : {
          "type" : "broadcast_shard_operation_failed_exception",
          "reason" : """java.lang.NullPointerException: Cannot invoke "String.startsWith(String)" because "this.value" is null
	at org.elasticsearch.xpack.constantkeyword.mapper.ConstantKeywordFieldMapper$ConstantKeywordFieldType.getTerms(ConstantKeywordFieldMapper.java:156)
	at org.elasticsearch.xpack.core.termsenum.action.TransportTermsEnumAction.dataNodeOperation(TransportTermsEnumAction.java:351)
	at org.elasticsearch.xpack.core.termsenum.action.TransportTermsEnumAction.lambda$asyncNodeOperation$0(TransportTermsEnumAction.java:712)
	at org.elasticsearch.action.ActionRunnable.lambda$supply$0(ActionRunnable.java:47)
	at org.elasticsearch.action.ActionRunnable$2.doRun(ActionRunnable.java:62)
	at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:26)
	at org.elasticsearch.common.util.concurrent.TimedRunnable.doRun(TimedRunnable.java:33)
	at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(ThreadContext.java:773)
	at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:26)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
	at java.base/java.lang.Thread.run(Thread.java:833)
""",
          "index_uuid" : "e8KIwULjSsSn3NGdm7tuPw",
          "shard" : "0",
          "index" : ".ds-metrics-endpoint.policy-default-2022.04.22-000007"
        }
      },
      {
        "shard" : 0,
        "index" : ".ds-metrics-endpoint.policy-default-2022.04.25-000008",
        "status" : "INTERNAL_SERVER_ERROR",
        "reason" : {
          "type" : "broadcast_shard_operation_failed_exception",
          "reason" : """java.lang.NullPointerException: Cannot invoke "String.startsWith(String)" because "this.value" is null
	at org.elasticsearch.xpack.constantkeyword.mapper.ConstantKeywordFieldMapper$ConstantKeywordFieldType.getTerms(ConstantKeywordFieldMapper.java:156)
	at org.elasticsearch.xpack.core.termsenum.action.TransportTermsEnumAction.dataNodeOperation(TransportTermsEnumAction.java:351)
	at org.elasticsearch.xpack.core.termsenum.action.TransportTermsEnumAction.lambda$asyncNodeOperation$0(TransportTermsEnumAction.java:712)
	at org.elasticsearch.action.ActionRunnable.lambda$supply$0(ActionRunnable.java:47)
	at org.elasticsearch.action.ActionRunnable$2.doRun(ActionRunnable.java:62)
	at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:26)
	at org.elasticsearch.common.util.concurrent.TimedRunnable.doRun(TimedRunnable.java:33)
	at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(ThreadContext.java:773)
	at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:26)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
	at java.base/java.lang.Thread.run(Thread.java:833)
""",
          "index_uuid" : "bDskzrgwQbG35K389_yyKA",
          "shard" : "0",
          "index" : ".ds-metrics-endpoint.policy-default-2022.04.25-000008"
        }
      }
    ]
  },
  "terms" : [
    "metrics"
  ],
  "complete" : false
}
```
x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/termsenum/action/TransportTermsEnumAction.java
Client remoteClient = remoteClusterService.getRemoteClusterClient(transportService.getThreadPool(), clusterAlias);
                remoteClient.execute(TermsEnumAction.INSTANCE, req, new ActionListener<>() {
                    @Override
                    public void onResponse(TermsEnumResponse termsEnumResponse) {
                        onRemoteClusterResponse(
                            clusterAlias,
                            opsIndex,
                            new RemoteClusterTermsEnumResponse(clusterAlias, termsEnumResponse)
                        );
                    }
                    @Override
                    public void onFailure(Exception exc) {
                        onRemoteClusterFailure(clusterAlias, opsIndex, exc);
                    }
                });
            } catch (Exception exc) {
                onRemoteClusterFailure(clusterAlias, opsIndex, null);
            }
        }
        private void onNodeResponse(String nodeId, int opsIndex, NodeTermsEnumResponse response) {
            logger.trace("received response for node {}", nodeId);
            atomicResponses.set(opsIndex, response);
            if (expectedOps == counterOps.incrementAndGet()) {
                finishHim(true);
            } else {
                checkForEarlyFinish();
            }
        }
        private void onRemoteClusterResponse(String clusterAlias, int opsIndex, RemoteClusterTermsEnumResponse response) {
            logger.trace("received response for cluster {}", clusterAlias);