How to modify terms query scoring function

My document is given bellow:

"display_name": "WarriorWorld234",
"friends": [

My query is

"terms": {
"friends": [

But irrespective of how many ever keywords matched, The score is just a constant score. I want the score to be number of keywords found in the document. How do I achieve it?
I also want to return the number of keywords matched as part of result.
I don't want to use explain.
I don't want to use highlights either. This will increase the size of the results. I just want the count and not the list of matches per document.

Use a ‘term’ (singular) query.
If you have multiple search terms put multiple term queriy clauses in a bool query’s “should” array.

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