-
Notifications
You must be signed in to change notification settings - Fork 25.2k
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
ES|QL Reranker command #123074
ES|QL Reranker command #123074
Conversation
9d2471e
to
fae22df
Compare
…esql-reranker-boostrap
…esql-reranker-boostrap
…esql-reranker-boostrap
…esql-reranker-boostrap
…esql-reranker-boostrap
…esql-reranker-boostrap
…esql-reranker-boostrap
…renceServicePlugin
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left some more comments.
).<PreAnalysisResult>andThen((l, enrichResolution) -> resolveFieldNames(parsed, enrichResolution, l)); | ||
) | ||
.<PreAnalysisResult>andThen((l, enrichResolution) -> resolveFieldNames(parsed, enrichResolution, l)) | ||
.<PreAnalysisResult>andThen((l, preAnalysisResult) -> resolveInferences(preAnalysis.inferencePlans, preAnalysisResult, l)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be great if we parallelized these resolutions, as they're not interdependent. But not necessarily a current conern.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a tech debt item to the meta-issue for later.
@@ -81,6 +82,7 @@ public class TransportEsqlQueryAction extends HandledTransportAction<EsqlQueryRe | |||
private final AsyncTaskManagementService<EsqlQueryRequest, EsqlQueryResponse, EsqlQueryTask> asyncTaskManagementService; | |||
private final RemoteClusterService remoteClusterService; | |||
private final UsageService usageService; | |||
private final InferenceService inferenceService; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems to only be used in c'tor, can it be local?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done! Good catch/
this.computeService = new ComputeService( | ||
searchService, | ||
transportService, | ||
exchangeService, | ||
enrichLookupService, | ||
lookupFromIndexService, | ||
inferenceService, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of adding a new param here, it might worth looking if the ComputeService
c'tor shouldn't maybe take a TransportActionServices
as param, as they share a few args.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did update the ComputeService
constructor as described in your comment.
x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/planner/mapper/Mapper.java
Outdated
Show resolved
Hide resolved
// Ensure the score attribute is present in the output. | ||
if (rerank.scoreAttribute() instanceof UnresolvedAttribute ua) { | ||
Attribute resolved = resolveAttribute(ua, childrenOutput); | ||
if (resolved.resolved() == false || resolved.dataType() != DOUBLE) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add the _score if it is missing so the user doo not have to worry about it
What happens if there's a search function following a RERANK
?
Can we add some tests with this too?
he RERANK command overwrite the _score column and sort the result by _score DESC, so having the _score attribute is mandatory.
I guess it might be mandatory for execution, but we could still choose to only keep it projected if the user chooses to. Just like with adding a SORT part of surrogating RERANK
, we could choose to finally DROP the _score
if not enabled explicitly.
This is somewhat similar to how search functions/operator doe influence the _score
, but the user can choose if they want to have it in the output.
@@ -397,6 +397,47 @@ public static boolean clusterHasInferenceEndpoint(RestClient client) throws IOEx | |||
return true; | |||
} | |||
|
|||
public static void createRerankInferenceEndpoint(RestClient client) throws IOException { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It'd be nice if we could set this service in the main() above too, this way one can have a testing cluster prepared "loaded" with that. If possible, this can be a follow-up.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added as a follow-up in the meta-issue.
4a5a19e
to
132825d
Compare
…esql-reranker-boostrap
…esql-reranker-boostrap
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
…esql-reranker-boostrap
If the clusters don't support inference test services, skip tests that require inference services. Hence, we should check for rerank tests. Relates #123074
Implementation of the
RERANK
commandCommand syntax
where
query text
is a constant string (can use a param instead?queryText
)ON
clause contains one or several field separated by commaON title, description=overview
)ON title, short_description=SUBSTRING(description,0 100)
)WITH
the name of inference endpoint to be used for reranking. The inference endpoint task type has to bererank
Done:
Follow-up: