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
try (
            EsqlQueryResponse results = run(
                "from test | stats a=avg(count), mi=min(count), ma=max(count), s=sum(count), c=count(count) by color"
            )
        ) {
            logger.info(results);
            assertEquals(6, results.columns().size());
            assertEquals(3, getValuesList(results).size());
            
            assertEquals("a", results.columns().get(0).name());
            assertEquals("double", results.columns().get(0).type());
            assertEquals("mi", results.columns().get(1).name());
            assertEquals("long", results.columns().get(1).type());
            assertEquals("ma", results.columns().get(2).name());
            assertEquals("long", results.columns().get(2).type());
            assertEquals("s", results.columns().get(3).name());
            assertEquals("long", results.columns().get(3).type());
            assertEquals("c", results.columns().get(4).name());
            assertEquals("long", results.columns().get(4).type());
            assertEquals("color", results.columns().get(5).name());
            assertEquals("keyword", results.columns().get(5).type());
            record Group(double avg, long mi, long ma, long s, long c, String color) {}
            List<Group> expectedGroups = List.of(
                new Group(42, 42, 42, 420, 10, "blue"),
                new Group(44, 44, 44, 440, 10, "green"),
                new Group(43, 40, 46, 860, 20, "red")
            );
            
            List<Group> actualGroups = getValuesList(results).stream()
                .map(