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
logger.info(results);
            assertEquals(3, results.columns().size());
            assertEquals(10, getValuesList(results).size());
            
            assertEquals("data", results.columns().get(0).name());
            assertEquals("long", results.columns().get(0).type());
            assertEquals("count", results.columns().get(1).name());
            assertEquals("long", results.columns().get(1).type());
            assertEquals("color", results.columns().get(2).name());
            assertEquals("keyword", results.columns().get(2).type());
            record Group(Long data, Long count, String color) {
                Group(Long data, Long count) {
                    this(data, count, "yellow");
                }
            }
            List<Group> expectedGroups = List.of(
                
                new Group(null, 50L),
                new Group(null, 60L),
                new Group(null, 70L),
                new Group(null, 80L),
                new Group(null, 90L),
                new Group(null, 100L),
                new Group(10L, null),
                new Group(10L, 100L),
                new Group(9L, null),
                new Group(9L, 90L)
            );
            List<Group> actualGroups = getValuesList(results).stream()
                .map(l -> new Group((Long) l.get(0), (Long) l.get(1), (String) l.get(2)))