Skip to content

ESQL: Push filters on right hand-side of joins #132635

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

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

bpintea
Copy link
Contributor

@bpintea bpintea commented Aug 11, 2025

This adds the logic to push filters down the right hand-side of joins (excepting InlineJoin). This is done for those filters that can be pushed down all the way to Lucene only.

Closes #130024

This adds the logic to push filters down the right hand-side of joins
(excepting `InlineJoin`). This only happens for those filters that can
be pushed down all the way to Lucene.
@elasticsearchmachine
Copy link
Collaborator

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

elasticsearchmachine and others added 2 commits August 11, 2025 09:10
return false;
}
// TODO: the flag isn't relevant for the pushdown decision?
LucenePushdownPredicates pushdownPredicates = LucenePushdownPredicates.from(ctx.searchStats(), new EsqlFlags(true));
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 problematic - thanks @alex-spies for raising the obvious point - since the ctx doesn't contain the stats for the lookup index. Getting the lookup index stats in there on the data node seems doable, since this is done using the SearchService on the local node based on a ShardId; these are sent from coordinator in the DataNodeRequest. And on the coordinator, they are resolved based on the index name. Currently, lookup indices are filtered out from resolving this index name to shard ids mapping (PlannerUtils#forEachRelation).
However, even if this filter is removed, the lookup index shard ids need to be handled differently when selecting a data node to send a compute request to, since only the nodes with FROM indices need to be considered (and not those with a LOOKUP JOIN index).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ESQL: LOOKUP JOIN push down for filters on lookup index fields
2 participants