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
assertNull(getValuesList(results).get(0).get(0));
        }
    }
    public void testFromStatsLimit() {
        try (EsqlQueryResponse results = run("from test | stats ac = avg(count) by data | limit 1")) {
            logger.info(results);
            assertThat(results.columns(), contains(new ColumnInfo("ac", "double"), new ColumnInfo("data", "long")));
            assertThat(getValuesList(results), contains(anyOf(contains(42.0, 1L), contains(44.0, 2L))));
        }
    }
    public void testFromLimit() {
        try (EsqlQueryResponse results = run("from test | keep data | limit 2")) {
            logger.info(results);
            assertThat(results.columns(), contains(new ColumnInfo("data", "long")));
            assertThat(getValuesList(results), contains(anyOf(contains(1L), contains(2L)), anyOf(contains(1L), contains(2L))));
        }
    }
    public void testDropAllColumns() {
        try (EsqlQueryResponse results = run("from test | keep data | drop data | eval a = 1")) {
            logger.info(results);
            assertThat(results.columns(), hasSize(1));
            assertThat(results.columns(), contains(new ColumnInfo("a", "integer")));
            assertThat(getValuesList(results), is(empty()));
        }
    }
    public void testDropAllColumnsWithStats() {
        try (EsqlQueryResponse results = run("from test | stats g = count(data) | drop g")) {
            logger.info(results);
            assertThat(results.columns(), is(empty()));
            assertThat(getValuesList(results), is(empty()));