Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ESQL: Mismatching mapping cannot be worked around with eval (Support for union types) #100603

Closed
craigtaverner opened this issue Oct 10, 2023 · 5 comments · Fixed by #107545
Closed
Assignees
Labels
:Analytics/ES|QL AKA ESQL >enhancement Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo)

Comments

@craigtaverner
Copy link
Contributor

craigtaverner commented Oct 10, 2023

I have multiple indices with the field host.ip, and most are mapped as type ip, but one is mapped as keyword. In a recent discussion it was mentioned that we could get around this using functions to convert types, however that does not appear to work:

from logs-* | eval host_ip = to_ip(host.ip) | KEEP host_ip, data_stream.dataset | LIMIT 2

Produces the error:

Found 1 problem
line 1:36: Cannot use field [host.ip] due to ambiguities being mapped as [2] incompatible types:
  [keyword] in [.ds-logs-k8-application.log-default-2023.10.10-000001],
  [ip] in [.ds-logs-apache.access-default-2023.10.10-000001, .ds-logs-apache.error-default-2023.10.10-000001, .ds-logs-kafka.log-default-2023.10.10-000001, .ds-logs-mysql.error-default-2023.10.10-000001, .ds-logs-mysql.slowlog-default-2023.10.10-000001, .ds-logs-nginx.access-default-2023.10.10-000001, .ds-logs-nginx.error-default-2023.10.10-000001, .ds-logs-postgresql.log-default-2023.10.10-000001, .ds-logs-redis.log-default-2023.10.10-000001, .ds-logs-redis.slowlog-default-2023.10.10-000001, .ds-logs-system.auth-default-2023.10.10-000001, .ds-logs-system.syslog-default-2023.10.10-000001]

Trying to keep the same name using eval host.ip = to_ip(host.ip) also results in the same error. If I run instead on indices that have only keyword or only ip, then both queries work.

@craigtaverner craigtaverner added >bug Team:QL (Deprecated) Meta label for query languages team :Analytics/ES|QL AKA ESQL labels Oct 10, 2023
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-ql (Team:QL)

@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/elasticsearch-esql (:Query Languages/ES|QL)

@craigtaverner
Copy link
Contributor Author

In discussions it was learned that this is not currently supported and not completely trivial to support either, since the current query planning process assumes a singular type for all fields coming from the indices, and throughout the query. Since querying multiple indices with different field types is in fact a common Elasticsearch use case, we'd like to support this at some point, so we'll label this as an enhancement and re-consider it later.

@costin costin added this to the 8.12 milestone Nov 16, 2023
@wchaparro wchaparro removed this from the 8.12 milestone Dec 20, 2023
@wchaparro wchaparro added the Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) label Jan 2, 2024
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-analytics-geo (Team:Analytics)

@elasticsearchmachine elasticsearchmachine removed the Team:QL (Deprecated) Meta label for query languages team label Jan 2, 2024
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-analytical-engine (Team:Analytics)

@craigtaverner craigtaverner changed the title ESQL: Mismatching mapping cannot be worked around with eval ESQL: Mismatching mapping cannot be worked around with eval (union types) May 2, 2024
@wchaparro wchaparro changed the title ESQL: Mismatching mapping cannot be worked around with eval (union types) ESQL: Mismatching mapping cannot be worked around with eval (Support for union types) May 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Analytics/ES|QL AKA ESQL >enhancement Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo)
Projects
None yet
5 participants