### Elasticsearch Version

main

### Installed Plugins

_No response_

### Java Version

_bundled_

### OS Version

Darwin

### Problem Description

Sorting fails sometimes with the error

```
No TopN sorting encoder for type UNSUPPORTED
```


### Steps to Reproduce

Playing with ES|QL I tried to run the following query

`from logstash-* | sort extension.keyword`

This returns the error

```
No TopN sorting encoder for type UNSUPPORTED
```

If I run the query:

`from logstash-*  | keep extension.keyword | sort extension.keyword`

the data return successfully.

### Logs (if relevant)

_No response_
x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/operator/topn/TopNEncoder.java
/**
     * An encoder for UTF-8 text.
     */
    UTF8TopNEncoder UTF8 = new UTF8TopNEncoder();
    /**
     * An encoder for semver versions.
     */
    VersionTopNEncoder VERSION = new VersionTopNEncoder();
    void encodeLong(long value, BreakingBytesRefBuilder bytesRefBuilder);
    long decodeLong(BytesRef bytes);
    void encodeInt(int value, BreakingBytesRefBuilder bytesRefBuilder);
    int decodeInt(BytesRef bytes);
    void encodeDouble(double value, BreakingBytesRefBuilder bytesRefBuilder);
    double decodeDouble(BytesRef bytes);
    void encodeBoolean(boolean value, BreakingBytesRefBuilder bytesRefBuilder);
    boolean decodeBoolean(BytesRef bytes);
    int encodeBytesRef(BytesRef value, BreakingBytesRefBuilder bytesRefBuilder);
    BytesRef decodeBytesRef(BytesRef bytes, BytesRef scratch);
    /**
     * Get a version of this encoder that encodes values such that sorting
     * the encoded bytes sorts by the values.
     */
    TopNEncoder toSortable();
    /**
     * Get a version of this encoder that encodes values as fast as possible
     * without making the encoded bytes sortable.
     */
    TopNEncoder toUnsortable();
}