Hello
context
In my use case I rank documents regarding an input request relying on a compound score used for the ranking. This compound score is a weighted sum of 3 text similarity scores as follow:
score = weight1 * score1 + weight2 * score2 + weight3 * score3
.
Each score relates to a given text field and similarity defined in the index mapping, for instance:
{
"settings": {
"similarity": {"text_similarity":{}} # not detailed here
},
"mappings": {
"properties": {
"text1": {
"type": "text",
"similarity": "text_similarity",
}
}
# same for text2 and text3
}
}
On the query side, I have a function score for each score, for instance:
{
"query": {
"bool": {
"should": [
{
"function_score": {
"query": {"match" : {"text1": request_text1}},
"boost": weight1
}
# function score text2
# function score text3
]
}
}
}
Problem
My goal is to have the detail of each score beside the final compound score.
I am aware of explain API, however the order of the 3 function scores in the explanation
changes which makes difficult to associate a given value to a score.
Moreover the explain API impacts significantly the query time.
Is there a better way to obtain the detail of each score? Am I missing something?