### Description

Something like `select * from apps where version > '1.2.3'::version` fails with:
```
Caused by: java.lang.IllegalArgumentException: Illegal value type: class org.elasticsearch.xpack.versionfield.Version, value: 1.2.3
	at org.elasticsearch.xpack.versionfield.VersionStringFieldMapper$VersionStringFieldType.indexedValueForSearch(VersionStringFieldMapper.java:287)
	at org.elasticsearch.xpack.versionfield.VersionStringFieldMapper$VersionStringFieldType.rangeQuery(VersionStringFieldMapper.java:320)
	at org.elasticsearch.server@8.9.0-SNAPSHOT/org.elasticsearch.index.mapper.SimpleMappedFieldType.rangeQuery(SimpleMappedFieldType.java:52)
	at org.elasticsearch.server@8.9.0-SNAPSHOT/org.elasticsearch.index.query.RangeQueryBuilder.doToQuery(RangeQueryBuilder.java:539)
	at org.elasticsearch.server@8.9.0-SNAPSHOT/org.elasticsearch.index.query.AbstractQueryBuilder.toQuery(AbstractQueryBuilder.java:115)
	at org.elasticsearch.server@8.9.0-SNAPSHOT/org.elasticsearch.index.query.SearchExecutionContext.lambda$toQuery$4(SearchExecutionContext.java:486)
	at org.elasticsearch.server@8.9.0-SNAPSHOT/org.elasticsearch.index.query.SearchExecutionContext.toQuery(SearchExecutionContext.java:498)
	... 15 more


```
x-pack/plugin/ql/src/main/java/org/elasticsearch/xpack/ql/planner/ExpressionTranslators.java
}
                }
            }
            if (terms.isEmpty() == false) {
                String fieldName = field.exactAttribute().name();
                queries.add(new TermsQuery(in.source(), fieldName, terms));
            }
            return queries.stream().reduce((q1, q2) -> or(in.source(), q1, q2)).get();
        }
    }
    public static class Scalars extends ExpressionTranslator<ScalarFunction> {
        @Override
        protected Query asQuery(ScalarFunction f, TranslatorHandler handler) {
            return doTranslate(f, handler);
        }
        public static Query doTranslate(ScalarFunction f, TranslatorHandler handler) {
            Query q = doKnownTranslate(f, handler);
            if (q != null) {
                return q;
            }
            return handler.wrapFunctionQuery(f, f, () -> new ScriptQuery(f.source(), f.asScript()));
        }
        public static Query doKnownTranslate(ScalarFunction f, TranslatorHandler handler) {
            if (f instanceof StartsWith sw) {
                if (sw.input() instanceof FieldAttribute && sw.pattern().foldable()) {
                    String targetFieldName = handler.nameOf(((FieldAttribute) sw.input()).exactAttribute());
                    String pattern = (String) sw.pattern().fold();
                    return new PrefixQuery(f.source(), targetFieldName, pattern, sw.isCaseInsensitive());
                }
            }