Skip to content

ES|QL: Linear combination in FUSE#134543

Merged
ioanatia merged 8 commits intoelastic:mainfrom
ioanatia:fuse_linear_combination
Sep 17, 2025
Merged

ES|QL: Linear combination in FUSE#134543
ioanatia merged 8 commits intoelastic:mainfrom
ioanatia:fuse_linear_combination

Conversation

@ioanatia
Copy link
Copy Markdown
Member

@ioanatia ioanatia commented Sep 11, 2025

meta issue: #123389

Adds linear combination support for FUSE:

FROM books METADATA _id, _index, _score
| FORK ( WHERE title:"Tolkien" | SORT _score, _id DESC | LIMIT 3 )
       ( WHERE author:"Tolkien" | SORT _score, _id DESC | LIMIT 3 )
| FUSE linear WITH {"normalizer": "minmax", "weights": { "fork1": 0.3, "fork2": 0.7 }}

@ioanatia ioanatia added >non-issue Team:Search - Relevance The Search organization Search Relevance team v9.2.0 :Search Relevance/ES|QL Search functionality in ES|QL labels Sep 11, 2025
@ioanatia ioanatia marked this pull request as ready for review September 16, 2025 10:02
@elasticsearchmachine elasticsearchmachine added Team:Search Relevance Meta label for the Search Relevance team in Elasticsearch and removed Team:Search - Relevance The Search organization Search Relevance team labels Sep 16, 2025
@elasticsearchmachine
Copy link
Copy Markdown
Collaborator

Pinging @elastic/es-search-relevance (Team:Search Relevance)

Copy link
Copy Markdown
Member

@carlosdelest carlosdelest left a comment

Choose a reason for hiding this comment

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

LGTM! Some minor nits

};
}

private abstract class Normalizer {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nit - Is this an interface, as it does not provide any method implementation?

public record Factory(int forkPosition, int scorePosition, double rankConstant, Map<String, Double> weights)
implements
OperatorFactory {
public record Factory(int discriminatorPosition, int scorePosition, RrfConfig rrfConfig) implements OperatorFactory {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nice to see the Config classes used ❤️

}
}

public void testLinearInvalidOptions() {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can we move these to the AnalyzerTests / StatementParserTests? It would be nice not needing to do an IT for checking the options

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I think I have tests for these in AnalyzerTests so I can just remove them

});
}

private void validateLinearOptions(Failures failures) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'm thinking on moving these to the enum themselves - it's sad that we're dealing with parsing concerns, but could be pretty neat to delegate the parsing to them. WDYT?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I need to think a bit more about this 🤔 . There are other commands that have options too and I am not sure if there's an opportunity to have a unified way to parse/validate options for commands.
Okay if I follow up on this separately?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Okay if I follow up on this separately?

Yes, it's unclear to me if that's a good option or not. As you say, let's keep an eye on this and do some refactoring if it makes sense in the future.

@ioanatia ioanatia merged commit ea368d7 into elastic:main Sep 17, 2025
34 checks passed
@ioanatia ioanatia deleted the fuse_linear_combination branch September 17, 2025 07:46
mridula-s109 pushed a commit to mridula-s109/elasticsearch that referenced this pull request Sep 17, 2025
gmjehovich pushed a commit to gmjehovich/elasticsearch that referenced this pull request Sep 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

>non-issue :Search Relevance/ES|QL Search functionality in ES|QL Team:Search Relevance Meta label for the Search Relevance team in Elasticsearch v9.2.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants