How to modify terms query scoring function

My document is given bellow:

{
"display_name": "WarriorWorld234",
"friends": [
"b2ad7a2c-cdf4-4d69-84df-696df7091bcd",
"da64898a-d2cb-4f58-b636-a15c05bbad44"
]
}

My query is

"terms": {
"friends": [
"66e77329-c1d8-4504-a3c3-fcda6a270a5e"
]
}

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.