Skip to content

Consider support for a script rescorer #52338

@jtibshirani

Description

@jtibshirani

It could be a nice addition to allow for script-based rescoring:

POST /_search
{
   "query" : {
      "match" : {
         "title" : {
            "query" : "ethics of ambiguity"
         }
      }
   },
   "rescore" : {
      "window_size" : 100,
      "script": {
        "source": "_score + saturation(doc['num_likes'].value + doc['num_reviews'].value, 1)"
      }
    }
}

It’s already possible to accomplish script rescoring by using a script_score query in a query rescorer. A dedicated script rescorer could have couple of benefits:

  • It’s a more intuitive, clear syntax.
  • The script could have easy access to the scores from the original query. When using a script_score rescore query, we have to either (1) duplicate the original query inside the rescore query in order to access the scores, or (2) use a match_all as the inner query and combine scores using query_weight/ score_mode. An example can be found in this discuss issue.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions