How to provide more score when the "terms" query has multiple match?


Hello, I started to elasticsearch few weeks ago and I encountered some difficulty finding the appropriate query for the results I am looking for.

Currently, by running the query written below, all documents (except for _doc/1) returns the same score. Ideally, the highest score should be given to the _doc/3since the array has more elements which match the query (so the score should be: id3 > id1 > id2 >id4)

Does elasticsearch provides some tool for doing this?
Any help would be appreciated.

Example of my documents
_id: 1
communities: ["A", "B", "C"]`

_id: 2
communities: ["A"]

_id: 3
communities: ["A","B","C","D","E","F"]

_id: 4

This is my query

"query": {
"bool": {
"should" : {
"terms" : {
"communities" : ["A", "B", "C", "D"]
"boost": 10