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 testInWithNullValue() {
        try (EsqlQueryResponse results = run("from test | where null in (data, 2) | keep data")) {
            assertThat(results.columns(), equalTo(List.of(new ColumnInfo("data", "long"))));
            assertThat(getValuesList(results).size(), equalTo(0));
        }
    }
    public void testTopNPushedToLucene() {
        for (int i = 5; i < 11; i++) {
            var yellowDocId = "yellow_" + i;
            var yellowNullCountDocId = "yellow_null_count_" + i;
            var yellowNullDataDocId = "yellow_null_data_" + i;
            client().prepareBulk()
                .add(new IndexRequest("test").id(yellowDocId).source("data", i, "count", i * 10, "color", "yellow"))
                .add(new IndexRequest("test").id(yellowNullCountDocId).source("data", i, "color", "yellow"))
                .add(new IndexRequest("test").id(yellowNullDataDocId).source("count", i * 10, "color", "yellow"))
                .get();
            if (randomBoolean()) {
                client().admin().indices().prepareRefresh("test").get();
            }
        }
        client().admin().indices().prepareRefresh("test").get();
        try (EsqlQueryResponse results = run("""
                from test
                | where color == "yellow"
                | sort data desc nulls first, count asc nulls first
                | limit 10
                | keep data, count, color
            """)) {