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
public void testLoadId() {
        try (EsqlQueryResponse results = run("from test [metadata _id] | keep _id | sort _id ")) {
            assertThat(results.columns(), equalTo(List.of(new ColumnInfo("_id", "keyword"))));
            ListMatcher values = matchesList();
            for (int i = 10; i < 50; i++) {
                values = values.item(List.of(Integer.toString(i)));
            }
            assertMap(getValuesList(results), values);
        }
    }
    public void testUnsupportedTypesOrdinalGrouping() {
        assertAcked(
            client().admin().indices().prepareCreate("index-1").setMapping("f1", "type=keyword", "f2", "type=keyword", "v", "type=long")
        );
        assertAcked(
            client().admin().indices().prepareCreate("index-2").setMapping("f1", "type=object", "f2", "type=keyword", "v", "type=long")
        );
        Map<String, Long> groups = new HashMap<>();
        int numDocs = randomIntBetween(10, 20);
        for (int i = 0; i < numDocs; i++) {
            String k = randomFrom("a", "b", "c");
            long v = randomIntBetween(1, 10);
            groups.merge(k, v, Long::sum);
            groups.merge(null, v, Long::sum); 
            client().prepareIndex("index-1").setSource("f1", k, "v", v).get();
            client().prepareIndex("index-2").setSource("f2", k, "v", v).get();
        }
        client().admin().indices().prepareRefresh("index-1", "index-2").get();
        for (String field : List.of("f1", "f2")) {
            try (var resp = run("from index-1,index-2 | stats sum(v) by " + field)) {