-
Notifications
You must be signed in to change notification settings - Fork 25.8k
Add new Script Score Query #31461
Copy link
Copy link
Closed
Labels
:Search Relevance/RankingScoring, rescoring, rank evaluation.Scoring, rescoring, rank evaluation.>enhancementTeam:Search RelevanceMeta label for the Search Relevance team in ElasticsearchMeta label for the Search Relevance team in Elasticsearch
Description
Replace Function Score Query with a new Script Score Query that will compute custom score through painless scripting.
GET /_search
{
"query": {
"script_score" : {
"query": {
"match": { "message": "elasticsearch" }
},
"script" : {
"source": "Math.log(2 + doc['likes'].value)"
},
"min_score" : 2
}
}
}Tasks:
- Introduce a new Script Score Query
- Develop documentation and tests for it (partially done)
- Handle missing and multiple values in Script
- addressed through Missing fields values unexpectedly return 0 in painless #29286 (PR submitted) - Introduce a new Script context in the painless
- Add random score function to the Script context (done in Add randomScore function in script_score query #40186)
- java's Random method should be sufficient
- make random function that uses Lucene doc ids
- ScriptScoreBuilder#doToQuery - investigate if we can dd salt - IndexName/ShardID to context manually - Add math functions to the Script context
- rational and sigmoid functions were added
- other functions can be implemented through Java's Math module
- later we will be able to drop "Math" prefix in Script context - Add decay functions to the Script context
- Add cosine similarity functions on dense and sparse vector fields
-
Add normalization functions to the Script context
- will not be implemented as the implementation can be very slow, and values can be normalized through log, rational, sigmoid and other functions
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
:Search Relevance/RankingScoring, rescoring, rank evaluation.Scoring, rescoring, rank evaluation.>enhancementTeam:Search RelevanceMeta label for the Search Relevance team in ElasticsearchMeta label for the Search Relevance team in Elasticsearch
Type
Fields
Give feedbackNo fields configured for issues without a type.