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

**URL:** <https://discuss.elastic.co/t/how-to-provide-more-score-when-the-terms-query-has-multiple-match/164168>\
**Category:** Elasticsearch\
**Created:** [January 14, 2019, 3:46pm UTC](https://discuss.elastic.co/t/how-to-provide-more-score-when-the-terms-query-has-multiple-match/164168 "2019-01-14T15:46:55Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![uranran15](https://avatars.discourse-cdn.com/v4/letter/u/13edae/32.png) [@uranran15](https://discuss.elastic.co/u/uranran15)\
**Post date:** [January 14, 2019, 3:46pm UTC](https://discuss.elastic.co/t/how-to-provide-more-score-when-the-terms-query-has-multiple-match/164168/1 "2019-01-14T15:46:55Z")

</div>

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/3`since 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**  
\_doc/1  
\_id: 1  
communities: ["A", "B", "C"]`

\_doc/2  
\_id: 2  
communities: ["A"]

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

\_doc/4  
\_id: 4  
communities:

**This is my query**

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

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [February 11, 2019, 3:46pm UTC](https://discuss.elastic.co/t/how-to-provide-more-score-when-the-terms-query-has-multiple-match/164168/2 "2019-02-11T15:46:59Z")

</div>

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