Skip to content

ES|QL: Add support for LOOKUP JOIN on aliases #128519

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

Merged
merged 10 commits into from
Jun 3, 2025

Conversation

luigidellaquila
Copy link
Contributor

@luigidellaquila luigidellaquila commented May 27, 2025

Adding support for LOOKUP JOIN on aliases:

  • remove validation checks for aliases
  • use the alias name for security checks
  • take into consideration alias filters

@elasticsearchmachine
Copy link
Collaborator

Hi @luigidellaquila, I've created a changelog YAML for you.

if (out.getTransportVersion().onOrAfter(TransportVersions.JOIN_ON_ALIASES)) {
out.writeString(indexPattern);
} else if (indexPattern.equals(shardId.getIndexName()) == false) {
throw new EsqlIllegalArgumentException("Aliases and index patterns are not allowed for LOOKUP JOIN []", indexPattern);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should we throw an exception here?
The alternative is to just allow to execute the JOIN on the remote node based on the index name (rather than the alias name), that means different security constraints and no alias filters.

Copy link
Member

Choose a reason for hiding this comment

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

Throwing is fine. It wasn't supported before that version.

@luigidellaquila luigidellaquila marked this pull request as ready for review May 29, 2025 09:31
@luigidellaquila luigidellaquila requested a review from nik9000 May 29, 2025 09:31
@elasticsearchmachine
Copy link
Collaborator

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

@elasticsearchmachine elasticsearchmachine added the Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) label May 29, 2025
@astefan astefan self-requested a review May 29, 2025 09:34
@@ -521,7 +553,7 @@ abstract static class TransportRequest extends AbstractTransportRequest implemen

@Override
public final String[] indices() {
return new String[] { shardId.getIndexName() };
return new String[] { indexPattern };
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the real fix to the Security aspects

if (out.getTransportVersion().onOrAfter(TransportVersions.JOIN_ON_ALIASES)) {
out.writeString(indexPattern);
} else if (indexPattern.equals(shardId.getIndexName()) == false) {
throw new EsqlIllegalArgumentException("Aliases and index patterns are not allowed for LOOKUP JOIN []", indexPattern);
Copy link
Member

Choose a reason for hiding this comment

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

Throwing is fine. It wasn't supported before that version.

@astefan astefan removed their request for review May 30, 2025 04:46
@luigidellaquila luigidellaquila added auto-backport Automatically create backport pull requests when merged v8.19.0 labels May 30, 2025
@luigidellaquila luigidellaquila enabled auto-merge (squash) June 3, 2025 10:18
@luigidellaquila luigidellaquila merged commit d1d7302 into elastic:main Jun 3, 2025
17 of 18 checks passed
@elasticsearchmachine
Copy link
Collaborator

💔 Backport failed

Status Branch Result
8.19 Commit could not be cherrypicked due to conflicts

You can use sqren/backport to manually backport by running backport --upstream elastic/elasticsearch --pr 128519

luigidellaquila added a commit to luigidellaquila/elasticsearch that referenced this pull request Jun 3, 2025
elasticsearchmachine pushed a commit that referenced this pull request Jun 3, 2025
* ES|QL: Add support for LOOKUP JOIN on aliases (#128519)

* Fix test
joshua-adams-1 pushed a commit to joshua-adams-1/elasticsearch that referenced this pull request Jun 3, 2025
Copy link
Contributor

@alex-spies alex-spies left a comment

Choose a reason for hiding this comment

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

Hey @luigidellaquila , I think this accidentally disabled some bwc tests. Could you take a look please?

@@ -6,7 +6,7 @@ setup:
- method: POST
path: /_query
parameters: []
capabilities: [join_lookup_v12, join_lookup_skip_mv_warnings]
capabilities: [join_lookup_v12, enable_lookup_join_on_aliases]
Copy link
Contributor

Choose a reason for hiding this comment

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

@luigidellaquila , this skips the entire yaml test file if the capability is not present. Is this intended? This means no bwc tests between 9.1 and 9.0 in here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point, let me split it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Analytics/ES|QL AKA ESQL auto-backport Automatically create backport pull requests when merged backport pending >enhancement Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) v8.19.0 v9.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants