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/main/java/org/elasticsearch/xpack/esql/expression/function/aggregate/CountDistinct.java
TypeResolution resolution = EsqlTypeResolutions.isExact(field(), sourceText(), DEFAULT);
        if (resolution.unresolved() || precision == null) {
            return resolution;
        }
        return isInteger(precision, sourceText(), SECOND).and(isFoldable(precision, sourceText(), SECOND));
    }
    @Override
    public AggregatorFunctionSupplier supplier(BigArrays bigArrays, List<Integer> inputChannels) {
        DataType type = field().dataType();
        int precision = this.precision == null ? DEFAULT_PRECISION : ((Number) this.precision.fold()).intValue();
        if (type == DataTypes.BOOLEAN) {
            
            return new CountDistinctBooleanAggregatorFunctionSupplier(bigArrays, inputChannels);
        }
        if (type == DataTypes.DATETIME || type == DataTypes.LONG) {
            return new CountDistinctLongAggregatorFunctionSupplier(bigArrays, inputChannels, precision);
        }
        if (type == DataTypes.INTEGER) {
            return new CountDistinctIntAggregatorFunctionSupplier(bigArrays, inputChannels, precision);
        }
        if (type == DataTypes.DOUBLE) {
            return new CountDistinctDoubleAggregatorFunctionSupplier(bigArrays, inputChannels, precision);
        }
        if (type == DataTypes.KEYWORD || type == DataTypes.IP) {
            return new CountDistinctBytesRefAggregatorFunctionSupplier(bigArrays, inputChannels, precision);
        }
        throw EsqlIllegalArgumentException.illegalDataType(type);
    }
}