Skip to content

[Lens] [ES|QL] Improved ES|QL conversion failure tooltip messages#249683

Merged
walterra merged 16 commits intoelastic:mainfrom
walterra:feat/lens-esql-failure-reasons
Jan 23, 2026
Merged

[Lens] [ES|QL] Improved ES|QL conversion failure tooltip messages#249683
walterra merged 16 commits intoelastic:mainfrom
walterra:feat/lens-esql-failure-reasons

Conversation

@walterra
Copy link
Copy Markdown
Contributor

@walterra walterra commented Jan 20, 2026

Summary

Part of https://github.com/elastic/kibana-team/issues/2179. Fixes #249912.

Adds some more granular failure reasons for ES|QL conversion:

  • non_utc_timezone - Timezone is not UTC

  • formula_not_supported - Lens formulas cannot be converted

  • time_shift_not_supported - Time shift operations not supported

  • runtime_field_not_supported - Runtime fields not supported

  • reduced_time_range_not_supported - Reduced time range not supported

  • function_not_supported - Operation type has no ES|QL equivalent

  • drop_partials_not_supported - Drop partial buckets not supported

  • include_empty_rows_not_supported - Include empty rows not supported

  • terms_not_supported - Terms aggregation not supported

  • unknown - Catch-all for unexpected failures

  • getESQLForLayer now returns EsqlQueryResult (success with data OR
    failure with reason)

  • Added isEsqlQuerySuccess type guard for safe property access

CleanShot 2026-01-23 at 10 18 02@2x

Checklist

Introduces specific failure reasons when ES|QL conversion is not possible:
- non_utc_timezone: Timezone is not UTC
- formula_not_supported: Lens formulas cannot be converted
- time_shift_not_supported: Time shift operations not supported
- runtime_field_not_supported: Runtime fields not supported
- reduced_time_range_not_supported: Reduced time range not supported
- function_not_supported: Operation type has no ES|QL equivalent
- drop_partials_not_supported: Drop partial buckets not supported
- include_empty_rows_not_supported: Include empty rows not supported
- terms_not_supported: Terms aggregation not supported
- unknown: Catch-all for unexpected failures

Changes:
- getESQLForLayer now returns EsqlQueryResult (success with data OR failure with reason)
- Added isEsqlQuerySuccess type guard for safe property access
- Updated to_expression.ts to use new type guard
- Updated use_esql_conversion.tsx to use new type guard
- Updated all tests to use new result structure

This enables better UX by showing users exactly why conversion failed.
@walterra walterra self-assigned this Jan 20, 2026
@walterra walterra requested a review from a team as a code owner January 20, 2026 11:02
@walterra walterra added backport:skip This PR does not require backporting Feature:Lens release_note:skip Skip the PR/issue when compiling release notes Team:Visualizations Team label for Lens, elastic-charts, Graph, legacy editors (TSVB, Visualize, Timelion) t// v9.4.0 labels Jan 20, 2026
@elasticmachine
Copy link
Copy Markdown
Contributor

Pinging @elastic/kibana-visualizations (Team:Visualizations)

Copy link
Copy Markdown
Contributor

@mariairiartef mariairiartef left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code review. Left some nit comments, thank you!

@elasticmachine
Copy link
Copy Markdown
Contributor

elasticmachine commented Jan 23, 2026

💔 Build Failed

Failed CI Steps

History

cc @walterra

@walterra walterra merged commit bf74c58 into elastic:main Jan 23, 2026
15 of 16 checks passed
@walterra walterra deleted the feat/lens-esql-failure-reasons branch January 23, 2026 18:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:skip This PR does not require backporting Feature:Lens release_note:skip Skip the PR/issue when compiling release notes Team:Visualizations Team label for Lens, elastic-charts, Graph, legacy editors (TSVB, Visualize, Timelion) t// v9.4.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Lens powered by ES|QL] Provide reasons for non-convertible charts: formulas and aggregations

3 participants