Skip to content

ESQL: union types not treating widened data types correctly #111277

@alex-spies

Description

@alex-spies

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.

Metadata

Metadata

Assignees

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions