The ES|QL `COUNT_DISTINCT` function fails with an `illegal agg type: text` error when it's run on a `text` field. It's fine with `keyword` fields. Compare to for example `COUNT`, which runs fine on text fields:

```
PUT test/_doc/1
{
  "foo": "bar"
}

# This fails with illegal agg type: text:
POST /_query
{
  "query": """
    FROM test
    | STATS count = COUNT_DISTINCT(foo)
  """
}

# This works:
POST /_query
{
  "query": """
    FROM test
    | STATS count = COUNT_DISTINCT(foo.keyword)
  """
}

# COUNT is fine with text fields:
POST /_query
{
  "query": """
    FROM test
    | STATS count = COUNT(foo)
  """
}
```

Full error message:

```
{
  "error": {
    "root_cause": [
      {
        "type": "esql_illegal_argument_exception",
        "reason": "illegal agg type: text"
      }
    ],
    "type": "esql_illegal_argument_exception",
    "reason": "illegal agg type: text"
  },
  "status": 500
}
```
x-pack/plugin/esql/src/internalClusterTest/java/org/elasticsearch/xpack/esql/action/EsqlActionIT.java
.setSettings(Settings.builder().put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, between(1, 5)))
                .setMapping("field", "type=long")
        );
        ensureYellow("test_overlapping_index_patterns_1");
        client().prepareBulk()
            .setRefreshPolicy(WriteRequest.RefreshPolicy.IMMEDIATE)
            .add(new IndexRequest("test_overlapping_index_patterns_1").id("1").source("field", 10))
            .get();
        assertAcked(
            client().admin()
                .indices()
                .prepareCreate("test_overlapping_index_patterns_2")
                .setSettings(Settings.builder().put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, between(1, 5)))
                .setMapping("field", "type=keyword")
        );
        ensureYellow("test_overlapping_index_patterns_2");
        client().prepareBulk()
            .setRefreshPolicy(WriteRequest.RefreshPolicy.IMMEDIATE)
            .add(new IndexRequest("test_overlapping_index_patterns_2").id("1").source("field", "foo"))
            .get();
        expectThrows(VerificationException.class, () -> run("from test_overlapping_index_patterns_* | sort field"));
    }
    public void testEmptyIndex() {
        assertAcked(client().admin().indices().prepareCreate("test_empty").setMapping("k", "type=keyword", "v", "type=long").get());
        try (EsqlQueryResponse results = run("from test_empty")) {
            assertThat(results.columns(), equalTo(List.of(new ColumnInfo("k", "keyword"), new ColumnInfo("v", "long"))));
            assertThat(getValuesList(results), empty());
        }
    }
    public void testShowInfo() {