Skip to content

[ES|QL] Support Expressions in Lookup Join Autocomplete#240735

Merged
bartoval merged 5 commits intoelastic:mainfrom
bartoval:lookup_join_autocomplete
Oct 27, 2025
Merged

[ES|QL] Support Expressions in Lookup Join Autocomplete#240735
bartoval merged 5 commits intoelastic:mainfrom
bartoval:lookup_join_autocomplete

Conversation

@bartoval
Copy link
Contributor

@bartoval bartoval commented Oct 27, 2025

Summary

This is part of #236939

  • We now use suggestForExpression instead of getFieldSuggestions, along with a couple utilities to enrich its context with join indices (including the logic to check common columns) .
  • For the ON part, we updated getPosition similar with other AST-based implementations.
  • Tests have been adapted but they cover the same cases.
@bartoval bartoval self-assigned this Oct 27, 2025
@bartoval bartoval requested a review from a team as a code owner October 27, 2025 05:48
});

// Filter out AS operator - it's not valid in boolean expressions
const filteredSuggestions = suggestions.filter(({ label }) => label !== 'AS');
Copy link
Contributor Author

Choose a reason for hiding this comment

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

AS uses location.JOIN but should not be suggested within ON.
A manual filter is sufficient for this specific case, instead of creating a new Location.JOIN_ON

@bartoval bartoval added release_note:skip Skip the PR/issue when compiling release notes backport:skip This PR does not require backporting Feature:ES|QL ES|QL related features in Kibana Team:ESQL ES|QL related features in Kibana t// labels Oct 27, 2025
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-esql (Team:ESQL)

@stratoula stratoula added release_note:enhancement and removed release_note:skip Skip the PR/issue when compiling release notes labels Oct 27, 2025
Copy link
Contributor

@stratoula stratoula 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 seems great, just a comment on the suggestions

Thanx Val!

Copy link
Contributor

Choose a reason for hiding this comment

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

Here we should also suggest | and comma as they are also a valid option

image

This is how it looks in main
image

We should have these + the expressions

Copy link
Contributor Author

@bartoval bartoval Oct 27, 2025

Choose a reason for hiding this comment

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

mmm 🤔💭... if you press run, does the query fail?
if I haven't misunderstood the grammar, we now support only Boolean expressions according to the grammar and in this case, we only have the left operand. In that case we don't have to close the statement

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes it runs. The expressions is an enhancement. We never break existing syntax

Copy link
Contributor

Choose a reason for hiding this comment

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

image
Copy link
Contributor Author

Choose a reason for hiding this comment

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

You are right. Thanks.

Added support for common fields

@bartoval bartoval requested a review from stratoula October 27, 2025 10:09
Copy link
Contributor

@stratoula stratoula left a comment

Choose a reason for hiding this comment

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

Me gusta mucho!! Gracias

Do we need to do anything on validation side?

@bartoval
Copy link
Contributor Author

Me gusta mucho!! Gracias

Do we need to do anything on validation side?

In theory yes. since we support boolean expressions inside ON (same case as Rerank).
I have almost finished the validation task. There is a difference compared to our traditional validations (it is async)

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
kbnUiSharedDeps-srcJs 4.0MB 4.0MB +3.5KB
Unknown metric groups

ESLint disabled in files

id before after diff
@kbn/esql-ast 7 8 +1

Total ESLint disabled count

id before after diff
@kbn/esql-ast 10 11 +1

cc @bartoval

@bartoval bartoval merged commit 5c9675f into elastic:main Oct 27, 2025
13 checks passed
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:ES|QL ES|QL related features in Kibana release_note:enhancement Team:ESQL ES|QL related features in Kibana t// v9.3.0

3 participants