# Using constant\_score to boost document scores

**URL:** <https://discuss.elastic.co/t/using-constant-score-to-boost-document-scores/15790>\
**Category:** Elasticsearch\
**Created:** [February 13, 2014, 9:05pm UTC](https://discuss.elastic.co/t/using-constant-score-to-boost-document-scores/15790 "2014-02-13T21:05:56Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![11140](https://avatars.discourse-cdn.com/v4/letter/1/e56c9b/32.png) [@11140](https://discuss.elastic.co/u/11140)\
**Post date:** [February 13, 2014, 9:05pm UTC](https://discuss.elastic.co/t/using-constant-score-to-boost-document-scores/15790/1 "2014-02-13T21:05:56Z")

</div>

Hi there!

New to elastic search.

Have a question regarding "constant\_score". When I use the "constant\_score"  
query and supply a "boost" param, the query returns docs with score still  
as 1, not multiplied with the boost.

Is it supposed to do that?

--  
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).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/6894681f-1682-4053-ba71-78ed6090db5b%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/6894681f-1682-4053-ba71-78ed6090db5b%40googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![jpountz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jpountz/32/45836_2.png) [@jpountz](https://discuss.elastic.co/u/jpountz)\
**Post date:** [February 13, 2014, 10:16pm UTC](https://discuss.elastic.co/t/using-constant-score-to-boost-document-scores/15790/2 "2014-02-13T22:16:09Z")

</div>

Hi,

This happens because of query normalization: the query normalization factor  
is 1/boost so in the end the score is multiplied by the boost and then  
divided by the boost again in the end, so the score remains 0.

However, this doesn't mean that the boost is always ignored! For example,  
if you wrap two constant-score queries into a boolean query:

{  
"query": {  
"bool": {  
"should": [  
{  
"constant\_score": {  
"filter": {  
"term": {  
"fifled": "value1"  
}  
},  
"boost": 2  
}  
},  
{  
"constant\_score": {  
"filter": {  
"term": {  
"field": "value2"  
}  
},  
"boost": 5  
}  
}  
]  
}  
}  
}

Documents that match "value2" will get a higher score than documents that  
match "value1".

--  
Adrien Grand

--  
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).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CAL6Z4j7me\_CRCvSan5zwh-MNOxUx1fgEqi6c9G-4zoxB\_W6%3DLA%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAL6Z4j7me_CRCvSan5zwh-MNOxUx1fgEqi6c9G-4zoxB_W6%3DLA%40mail.gmail.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, 1:50am UTC](https://discuss.elastic.co/t/using-constant-score-to-boost-document-scores/15790/3 "2017-07-06T01:50:22Z")

</div>


