Explain the function score of match_phrase_prefix

I have a problem with match_phrase_prefix query. Let me elaborate my case:
I use a script similarity like this:

  "similarity": {
      "custom_tfidf": {
        "type": "scripted",
        "script": {
          "source": "double tf = doc.freq > 0 ? 1 : 0; return query.boost * tf;"

When the match_phrase_prefix is applied on a query this is a query , the score for some result will be like this:

  • this is a query in the head. _score = 7
  • this is a query in the head with additional text. _score = 7
  • do you know this is a query. _score = 6

I have tried using explain in the elasticsearch query but the result was not clear why _score is 7 or 6. For 7 it is sum of seven 1 numbers.
I am also try to find in elasticsearch source code https://github.com/elastic/elasticsearch here but cannot find where is the code for calculating the _score above.
Could you please help me to make clear the function to calculate the above score? I'm so appreciative if you can help me to specify the function in the source code above.

Hi there. Please can help me for this topic.

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