Union types allow to use differently typed fields from different indices if they have the same name, e.g. client_ip with type ip in index1 and client_ip with type keyword in index2.
However, this seems broken for data types that esql widens, e.g. a field mapped short which esql internally represents using integer.
Reproducer:
curl -u elastic:password -H "Content-Type: application/json" "127.0.0.1:9200/testidx" -XPUT -d '{"mappings": {"properties": {"a": {"type":"short"}}}}'
curl -u elastic:password -H "Content-Type: application/json" "127.0.0.1:9200/testidx2" -XPUT -d '{"mappings": {"properties": {"a": {"type":"integer"}}}}'
curl -u elastic-admin:elastic-password -H "Content-Type: application/json" "127.0.0.1:9200/testidx/_doc" -d '{"a": 1}'
curl -u elastic-admin:elastic-password -H "Content-Type: application/json" "127.0.0.1:9200/testidx2/_doc" -d '{"a": 1}'
FROM testidx*
FROM testidx* | EVAL a = a::integer
The second query should work, but it returns an error complaining about a being ambiguous due to being mapped to different types.
Union types allow to use differently typed fields from different indices if they have the same name, e.g.
client_ipwith typeipinindex1andclient_ipwith typekeywordinindex2.However, this seems broken for data types that esql widens, e.g. a field mapped
shortwhich esql internally represents usinginteger.Reproducer:
The second query should work, but it returns an error complaining about
abeing ambiguous due to being mapped to different types.