# Scoring not behaving as expected

**URL:** <https://discuss.elastic.co/t/scoring-not-behaving-as-expected/13853>\
**Category:** Elasticsearch\
**Created:** [October 5, 2013, 1:44am UTC](https://discuss.elastic.co/t/scoring-not-behaving-as-expected/13853 "2013-10-05T01:44:40Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Andrew\_Soep\_2](https://avatars.discourse-cdn.com/v4/letter/a/a8b319/32.png) [@Andrew\_Soep\_2](https://discuss.elastic.co/u/Andrew_Soep_2)\
**Post date:** [October 5, 2013, 1:44am UTC](https://discuss.elastic.co/t/scoring-not-behaving-as-expected/13853/1 "2013-10-05T01:44:40Z")

</div>

I'm having some odd results (or it seems to me) in regards to the results  
returned by my queries. I'm doing a multi-match query against 4 fields, 1  
of which is a geographic location (US/Japan/Saudi Arabia etc) and the 3  
others are a mix of strings/arrays. The issue seems to be that the more  
hits on a document, the lower the document scores. So for example, if I  
have 10 documents with a similar geography (Saudi Arabia), and I do a query  
that contains Saudi Arabia and ice cream, the documents that simply have  
Saudi Arabia as the geography and no instance of ice cream in any of the  
other fields score higher than documents that have Saudi Arabia in the  
geography and at least one instance of ice cream in the other fields.

I'm confused why this would be. I would think that if a document had Saudi  
Arabia and Ice Cream, it would score much higher, since there are multiple  
instances of words. Am I off base here? Can anyone give me some insight?  
Should I be using a different query type? I tried boosting the  
non-geography fields, and it actually made the results even more confusing.

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [October 6, 2013, 5:29pm UTC](https://discuss.elastic.co/t/scoring-not-behaving-as-expected/13853/2 "2013-10-06T17:29:17Z")

</div>

Hey,

can you share some information about your queries (and also your mapping)?  
What kind of query are you executing, do you use bool queries with  
must/should clauses or are you simply querying the \_all field, are filters  
used as well? Some samples would be great (also including your boosting  
tries!

--Alex

On Sat, Oct 5, 2013 at 3:44 AM, Andrew Soep [siraris@gmail.com](mailto:siraris@gmail.com) wrote:

> I'm having some odd results (or it seems to me) in regards to the results  
> returned by my queries. I'm doing a multi-match query against 4 fields, 1  
> of which is a geographic location (US/Japan/Saudi Arabia etc) and the 3  
> others are a mix of strings/arrays. The issue seems to be that the more  
> hits on a document, the lower the document scores. So for example, if I  
> have 10 documents with a similar geography (Saudi Arabia), and I do a query  
> that contains Saudi Arabia and ice cream, the documents that simply have  
> Saudi Arabia as the geography and no instance of ice cream in any of the  
> other fields score higher than documents that have Saudi Arabia in the  
> geography and at least one instance of ice cream in the other fields.
> 
> I'm confused why this would be. I would think that if a document had  
> Saudi Arabia and Ice Cream, it would score much higher, since there are  
> multiple instances of words. Am I off base here? Can anyone give me some  
> insight? Should I be using a different query type? I tried boosting the  
> non-geography fields, and it actually made the results even more confusing.
> 
> --  
> You received this message because you are subscribed to the Google Groups  
> "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send an  
> email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Andrew\_Soep\_2](https://avatars.discourse-cdn.com/v4/letter/a/a8b319/32.png) [@Andrew\_Soep\_2](https://discuss.elastic.co/u/Andrew_Soep_2)\
**Post date:** [October 7, 2013, 8:38pm UTC](https://discuss.elastic.co/t/scoring-not-behaving-as-expected/13853/3 "2013-10-07T20:38:42Z")

</div>

Hi Alexander,

Here's my query:

{"multi\_match":{"query":"ice cream in saudi arabia","fields":["question","categories","responses","geography"]}},"size":50,"explain":true}

Here's mapping:

{  
"test : {  
"properties" : {  
"categories" : {  
"type" : "string"  
},  
"geography" : {  
"type" : "string"  
},  
"question" : {  
"type" : "string"  
},  
"question\_id" : {  
"type" : "string"  
},  
"responses" : {  
"type" : "string"  
}  
}  
}

On Sunday, October 6, 2013 12:29:17 PM UTC-5, Alexander Reelsen wrote:

> Hey,
> 
> can you share some information about your queries (and also your mapping)?  
> What kind of query are you executing, do you use bool queries with  
> must/should clauses or are you simply querying the \_all field, are filters  
> used as well? Some samples would be great (also including your boosting  
> tries!
> 
> --Alex
> 
> On Sat, Oct 5, 2013 at 3:44 AM, Andrew Soep \<[sir...@gmail.com](mailto:sir...@gmail.com)\<javascript:\>
> 
> > wrote:
> 
> > I'm having some odd results (or it seems to me) in regards to the results  
> > returned by my queries. I'm doing a multi-match query against 4 fields, 1  
> > of which is a geographic location (US/Japan/Saudi Arabia etc) and the 3  
> > others are a mix of strings/arrays. The issue seems to be that the more  
> > hits on a document, the lower the document scores. So for example, if I  
> > have 10 documents with a similar geography (Saudi Arabia), and I do a query  
> > that contains Saudi Arabia and ice cream, the documents that simply have  
> > Saudi Arabia as the geography and no instance of ice cream in any of the  
> > other fields score higher than documents that have Saudi Arabia in the  
> > geography and at least one instance of ice cream in the other fields.
> > 
> > I'm confused why this would be. I would think that if a document had  
> > Saudi Arabia and Ice Cream, it would score much higher, since there are  
> > multiple instances of words. Am I off base here? Can anyone give me some  
> > insight? Should I be using a different query type? I tried boosting the  
> > non-geography fields, and it actually made the results even more confusing.
> > 
> > --  
> > You received this message because you are subscribed to the Google Groups  
> > "elasticsearch" group.  
> > To unsubscribe from this group and stop receiving emails from it, send an  
> > email to [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com) \<javascript:\>.  
> > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Britta\_Weber](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/britta_weber/32/1113_2.png) [@Britta\_Weber](https://discuss.elastic.co/u/Britta_Weber)\
**Post date:** [October 16, 2013, 12:41pm UTC](https://discuss.elastic.co/t/scoring-not-behaving-as-expected/13853/4 "2013-10-16T12:41:51Z")

</div>

Hi Andrew,

there is two things in multi match that might cause the scoring  
behavior you see:  
First, I think multi match per default computes one score per field  
and then uses the maximum of these scores as the final score. So, more  
hits do not necessarily mean higher score with multi match using the  
default setting. If you set "use\_dis\_max":false the scores are summed.  
Second, when scoring for each field, the field length is also taken  
into account.  
Could you provide some example documents to check if this this is the  
reason for the scores you get?

Cheers,  
Britta

On Mon, Oct 7, 2013 at 10:38 PM, Andrew Soep [siraris@gmail.com](mailto:siraris@gmail.com) wrote:

> Hi Alexander,
> 
> Here's my query:
> 
> {"multi\_match":{"query":"ice cream in saudi  
> arabia","fields":["question","categories","responses","geography"]}},"size":50,"explain":true}
> 
> Here's mapping:
> 
> {  
> "test : {  
> "properties" : {  
> "categories" : {  
> "type" : "string"  
> },  
> "geography" : {  
> "type" : "string"  
> },  
> "question" : {  
> "type" : "string"  
> },  
> "question\_id" : {  
> "type" : "string"  
> },  
> "responses" : {  
> "type" : "string"  
> }  
> }  
> }
> 
> On Sunday, October 6, 2013 12:29:17 PM UTC-5, Alexander Reelsen wrote:
> 
> > Hey,
> > 
> > can you share some information about your queries (and also your mapping)?  
> > What kind of query are you executing, do you use bool queries with  
> > must/should clauses or are you simply querying the \_all field, are filters  
> > used as well? Some samples would be great (also including your boosting  
> > tries!
> > 
> > --Alex
> > 
> > On Sat, Oct 5, 2013 at 3:44 AM, Andrew Soep [sir...@gmail.com](mailto:sir...@gmail.com) wrote:
> > 
> > > I'm having some odd results (or it seems to me) in regards to the results  
> > > returned by my queries. I'm doing a multi-match query against 4 fields, 1  
> > > of which is a geographic location (US/Japan/Saudi Arabia etc) and the 3  
> > > others are a mix of strings/arrays. The issue seems to be that the more  
> > > hits on a document, the lower the document scores. So for example, if I  
> > > have 10 documents with a similar geography (Saudi Arabia), and I do a query  
> > > that contains Saudi Arabia and ice cream, the documents that simply have  
> > > Saudi Arabia as the geography and no instance of ice cream in any of the  
> > > other fields score higher than documents that have Saudi Arabia in the  
> > > geography and at least one instance of ice cream in the other fields.
> > > 
> > > I'm confused why this would be. I would think that if a document had  
> > > Saudi Arabia and Ice Cream, it would score much higher, since there are  
> > > multiple instances of words. Am I off base here? Can anyone give me some  
> > > insight? Should I be using a different query type? I tried boosting the  
> > > non-geography fields, and it actually made the results even more confusing.
> > > 
> > > --  
> > > You received this message because you are subscribed to the Google Groups  
> > > "elasticsearch" group.  
> > > To unsubscribe from this group and stop receiving emails from it, send an  
> > > email to [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com).
> > > 
> > > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).
> 
> --  
> You received this message because you are subscribed to the Google Groups  
> "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send an  
> email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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 6, 2017, 2:12am UTC](https://discuss.elastic.co/t/scoring-not-behaving-as-expected/13853/5 "2017-07-06T02:12:09Z")

</div>


