# More terms but lower score

**URL:** <https://discuss.elastic.co/t/more-terms-but-lower-score/29941>\
**Category:** Elasticsearch\
**Created:** [September 24, 2015, 7:56pm UTC](https://discuss.elastic.co/t/more-terms-but-lower-score/29941 "2015-09-24T19:56:09Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Eugene\_Strokin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/eugene_strokin/32/1238_2.png) [@Eugene\_Strokin](https://discuss.elastic.co/u/Eugene_Strokin)\
**Post date:** [September 24, 2015, 7:56pm UTC](https://discuss.elastic.co/t/more-terms-but-lower-score/29941/1 "2015-09-24T19:56:09Z")

</div>

Hello,  
I've create 3 document with multi values field:  
{ "query": {"match\_all": {}}}  
Result is here: [https://gist.github.com/strokine/f336d598a0781070154f](https://gist.github.com/strokine/f336d598a0781070154f)

Now I want to search by some of those terms, and I expect that more times the term repeated in the document, the score will be higher, like here for example:  
{  
"query": {"term": {  
"tags": {  
"value": "ww"  
}  
}}  
}

Result is here: [https://gist.github.com/strokine/4e3aca9980076016166f](https://gist.github.com/strokine/4e3aca9980076016166f)  
1st and 2nd documents have the same number of "ww" tags, so they have the same score.

But here:  
{  
"query": {"term": {  
"tags": {  
"value": "qq"  
}  
}}  
}

Result: [https://gist.github.com/strokine/7665fbaa53bff3b1dcbf](https://gist.github.com/strokine/7665fbaa53bff3b1dcbf)

Shows the document which has 2 "qq" tags the last, with the lowest score.

It looks like the total number of tags affected the result dramatically.

First of all, is my assumption right, that more same tags a document has, higher the number will be (I guess with equal total tag number between documents)?  
And if so, how could I prevent total number of tags affect the score that much?

Thanks,  
Eugene

---

<div class="post-metadata">

**Author:** ![softwaredoug](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/softwaredoug/32/22681_2.png) [@softwaredoug](https://discuss.elastic.co/u/softwaredoug)\
**Post date:** [September 24, 2015, 8:37pm UTC](https://discuss.elastic.co/t/more-terms-but-lower-score/29941/2 "2015-09-24T20:37:50Z")

</div>

Unfortunately It's not quite that simple. What you're talking about roughly is what's known as "term frequency." Documents with more of your term should get a higher relevance score. But the default relevance scoring also includes factors like the inverse document frequency, basically how rare a term is: rarer terms get high scores when they match. And also fieldnorms, which bias scoring towards shorter documents. There's also query normalization, which biases this query based on how relatively rare the terms are (ie based on IDF).

You can read more about the math involved [here](https://www.elastic.co/guide/en/elasticsearch/guide/current/practical-scoring-function.html) we also cover this in really extensive detail in chapter 3 of our book [Relevant Search](http://manning.com/turnbull)

---

<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:** [July 5, 2017, 11:48pm UTC](https://discuss.elastic.co/t/more-terms-but-lower-score/29941/3 "2017-07-05T23:48:12Z")

</div>


