Feature request: sorting using the output of multiple script scores #3715
Labels
enhancement
Enhancement or improvement to existing feature or request
feature
New feature or request
Indexing & Search
Hello OpenSearchers 👋
As part of planning migration away from using
function_score
-- based on a sense from elastic/elasticsearch#42811 that it may be deprecated in future -- I'm looking for alternative query workflows to support search operations that involve a combination of script evaluation and sorting.Background
The specific search use case is described here.
My explanation of the process: after matching documents are discovered, scoring is performed by evaluating a scoring script on them. The script emits a value that is a combination of two numeric calculations: a core "rank", and a subsequent "tiebreaker" that provides second-level sorting within groups of equally-ranked documents.
The only reason that
function_score
is used in the code is toreplace
the_score
value on each document with the script's return value.Feature Request
The feature request is to allow multiple scripts to be evaluated against matched documents, and to request sorting based on the output of those.
In other words: the feature would provide migration from a (pseudocode) query of the form:
run script {rank+tiebreaker} on each document => replace the {_score} with the {rank+tiebreaker} output => sort based on: {_score desc}
...to a query of the form:
run scripts [{rank}, {tiebreaker}] on each document => sort based on: [{rank desc}, {tiebreaker desc}]
Where the latter query form does not involve a
function_score
step.Other considerations
elasticsearch
andopensearch
- it's not intended as a competition, I'm not running an academic study, I don't want to waste anyone's time, and I have no particular relationship with either project - I'm just not aware of a better way (currently?) to raise awareness of a feature request that could be relevant to both projects other than duplicating the feature request itselfPlease let me know if there's any more information I can add or details that I can clarify.
The text was updated successfully, but these errors were encountered: