Is it possible to fetch original query's score in rescore query?

Hi,
I'm implementing a plugin to solve a rank problem which need original score as the base value. I already tried using script but it's slow than expected. Rescore query is faster but seems there is no direct way to fetch the original query's score. Is there any example to fetch it?

You can use a script inside a function score directly in the rescorer:

     "rescore_query" : {
        "function_score" : {
           "script_score": {
              "script": {
                "inline": "_score * ...."
              }
           }
        }
     }

You can access the original score in the script with the special field _score.

Already tried this , the score is always 1.0 which seems is the default match_all query's score for 'function_score' .

Ah right, _score is the score of the rescorer query not the original one, sorry. Then I don't think it's possible, can you open a feature request on ES github repo ?

ok, i'll create one.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.