# Boost value behaviour

**URL:** <https://discuss.elastic.co/t/boost-value-behaviour/10551>\
**Category:** Elasticsearch\
**Created:** [January 30, 2013, 9:54am UTC](https://discuss.elastic.co/t/boost-value-behaviour/10551 "2013-01-30T09:54:10Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Matt\_Thrower](https://avatars.discourse-cdn.com/v4/letter/m/a5b964/32.png) [@Matt\_Thrower](https://discuss.elastic.co/u/Matt_Thrower)\
**Post date:** [January 30, 2013, 9:54am UTC](https://discuss.elastic.co/t/boost-value-behaviour/10551/1 "2013-01-30T09:54:10Z")

</div>

Hi,

Hopefully a simple question, but one I'm finding hard to clear up from the  
documentation.

When you set a boost on a query, for example:

{"query": {  
"bool": {  
"must": [  
{"query\_string":{"fuzzy\_prefix\_length":3,"query":"description:SEARCH\_TERM"}}  
],  
"should": [  
{"range": { "item.rating": { "gt": 1000, "boost":100 } }},  
{"range": { "item.rating": { "lt": 10, "boost":0.01 } }}  
]  
}},  
"timeout": "15s",  
"size": 10,  
"from": 0}

How, exactly, are those boost values applied to the score in the results? I  
had assumed they were multipliers of some sort, so that 0.01 would reduce  
the score while 100 would increase it. However, messing about with various  
values would suggest they're actually added somewhere along the line, so  
0.01 increases the score a tiny amount, 100 a large amount, and something  
like -10 is required to have a negative impact on the score.

Indeed I had decided that they must be added somewhere, until I noted in  
the documentation that the default boost was 1. Which again made me wonder  
if it was a multiplier. It seems a curious default to use if the boost is  
added.

So, in the above query, what are those boost values actually doing to the  
scores? And for those records that don't match either range (so have a  
rating greater than ten but less than 100) what boost will be applied - the  
default of 1, or nothing because it's not specified?

Cheers,  
Matt

--  
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:** ![Clinton\_Gormley](https://avatars.discourse-cdn.com/v4/letter/c/50afbb/32.png) [@Clinton\_Gormley](https://discuss.elastic.co/u/Clinton_Gormley)\
**Post date:** [January 30, 2013, 10:15am UTC](https://discuss.elastic.co/t/boost-value-behaviour/10551/2 "2013-01-30T10:15:48Z")

</div>

> How, exactly, are those boost values applied to the score in the  
> results? I had assumed they were multipliers of some sort, so that  
> 0.01 would reduce the score while 100 would increase it. However,  
> messing about with various values would suggest they're actually added  
> somewhere along the line, so 0.01 increases the score a tiny amount,  
> 100 a large amount, and something like -10 is required to have a  
> negative impact on the score.
> 
> Indeed I had decided that they must be added somewhere, until I noted  
> in the documentation that the default boost was 1. Which again made me  
> wonder if it was a multiplier. It seems a curious default to use if  
> the boost is added.
> 
> So, in the above query, what are those boost values actually doing to  
> the scores? And for those records that don't match either range (so  
> have a rating greater than ten but less than 100) what boost will be  
> applied - the default of 1, or nothing because it's not specified?

It's kinda multiplied, but then also normalized - I'm not sure what the  
exact calculation is.

You can set {explain: true} in your query to get details about how the  
score was calculated.

Also, if you want to apply boost without normalization, then look at the  
custom\_boost\_factor query:

> **[Elasticsearch Platform — Find real-time answers at scale](https://www.elastic.co)**
>
> Power insights and outcomes with the Elasticsearch Platform and AI. See into your data and find answers that matter with enterprise solutions designed to help you build, observe, and protect. Try Elasticsearch free today.

clint

--  
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:** ![Matt\_Thrower](https://avatars.discourse-cdn.com/v4/letter/m/a5b964/32.png) [@Matt\_Thrower](https://discuss.elastic.co/u/Matt_Thrower)\
**Post date:** [January 30, 2013, 10:33am UTC](https://discuss.elastic.co/t/boost-value-behaviour/10551/3 "2013-01-30T10:33:30Z")

</div>

Thanks! That "explain" : true is pretty handy. I was very frustrated by how  
little information I was getting back from the queries.

OK, so the normalisation is basically wiping out my boosting. Is it  
possible to use custom\_boost\_factor in a "should" style query as I have  
done? I'm not sure how one would construct the syntax.

On Wednesday, 30 January 2013 10:15:48 UTC, Clinton Gormley wrote:

> > How, exactly, are those boost values applied to the score in the  
> > results? I had assumed they were multipliers of some sort, so that  
> > 0.01 would reduce the score while 100 would increase it. However,  
> > messing about with various values would suggest they're actually added  
> > somewhere along the line, so 0.01 increases the score a tiny amount,  
> > 100 a large amount, and something like -10 is required to have a  
> > negative impact on the score.
> > 
> > Indeed I had decided that they must be added somewhere, until I noted  
> > in the documentation that the default boost was 1. Which again made me  
> > wonder if it was a multiplier. It seems a curious default to use if  
> > the boost is added.
> > 
> > So, in the above query, what are those boost values actually doing to  
> > the scores? And for those records that don't match either range (so  
> > have a rating greater than ten but less than 100) what boost will be  
> > applied - the default of 1, or nothing because it's not specified?
> 
> It's kinda multiplied, but then also normalized - I'm not sure what the  
> exact calculation is.
> 
> You can set {explain: true} in your query to get details about how the  
> score was calculated.
> 
> Also, if you want to apply boost without normalization, then look at the  
> custom\_boost\_factor query:
> 
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/query-dsl/custom-boost-factor-query.html)
> 
> clint

--  
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:** ![Matt\_Thrower](https://avatars.discourse-cdn.com/v4/letter/m/a5b964/32.png) [@Matt\_Thrower](https://discuss.elastic.co/u/Matt_Thrower)\
**Post date:** [January 30, 2013, 10:37am UTC](https://discuss.elastic.co/t/boost-value-behaviour/10551/4 "2013-01-30T10:37:50Z")

</div>

Also, I note that the boost _is_ added, but only after it's been  
normalised. So the relevant "explain" seems to get a score, add the  
normalised boost, and then multiply the total by a "coord" score (no idea  
where that comes from).

On Wednesday, 30 January 2013 10:33:30 UTC, Matt Thrower wrote:

> Thanks! That "explain" : true is pretty handy. I was very frustrated by  
> how little information I was getting back from the queries.
> 
> OK, so the normalisation is basically wiping out my boosting. Is it  
> possible to use custom\_boost\_factor in a "should" style query as I have  
> done? I'm not sure how one would construct the syntax.
> 
> On Wednesday, 30 January 2013 10:15:48 UTC, Clinton Gormley wrote:
> 
> > > How, exactly, are those boost values applied to the score in the  
> > > results? I had assumed they were multipliers of some sort, so that  
> > > 0.01 would reduce the score while 100 would increase it. However,  
> > > messing about with various values would suggest they're actually added  
> > > somewhere along the line, so 0.01 increases the score a tiny amount,  
> > > 100 a large amount, and something like -10 is required to have a  
> > > negative impact on the score.
> > > 
> > > Indeed I had decided that they must be added somewhere, until I noted  
> > > in the documentation that the default boost was 1. Which again made me  
> > > wonder if it was a multiplier. It seems a curious default to use if  
> > > the boost is added.
> > > 
> > > So, in the above query, what are those boost values actually doing to  
> > > the scores? And for those records that don't match either range (so  
> > > have a rating greater than ten but less than 100) what boost will be  
> > > applied - the default of 1, or nothing because it's not specified?
> > 
> > It's kinda multiplied, but then also normalized - I'm not sure what the  
> > exact calculation is.
> > 
> > You can set {explain: true} in your query to get details about how the  
> > score was calculated.
> > 
> > Also, if you want to apply boost without normalization, then look at the  
> > custom\_boost\_factor query:
> > 
> > [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/query-dsl/custom-boost-factor-query.html)
> > 
> > clint

--  
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:** ![Clinton\_Gormley](https://avatars.discourse-cdn.com/v4/letter/c/50afbb/32.png) [@Clinton\_Gormley](https://discuss.elastic.co/u/Clinton_Gormley)\
**Post date:** [January 30, 2013, 10:46am UTC](https://discuss.elastic.co/t/boost-value-behaviour/10551/5 "2013-01-30T10:46:32Z")

</div>

On Wed, 2013-01-30 at 02:37 -0800, Matt Thrower wrote:

> Also, I note that the boost _is_ added, but only after it's been  
> normalised. So the relevant "explain" seems to get a score, add the  
> normalised boost, and then multiply the total by a "coord" score (no  
> idea where that comes from).

The coord is from a bool query (either used explicitly or auto-generated  
by another query). Eg if you have:

{ bool: {  
must: [{...},{...},{...}]  
}}

ie three clauses, then the coord will be 1/3. Each clause counts for  
1/3 of the total score.

You can disable\_coord in bool queries

> **[Elasticsearch Platform — Find real-time answers at scale](https://www.elastic.co)**
>
> Power insights and outcomes with the Elasticsearch Platform and AI. See into your data and find answers that matter with enterprise solutions designed to help you build, observe, and protect. Try Elasticsearch free today.

clint

--  
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:** ![Matt\_Thrower](https://avatars.discourse-cdn.com/v4/letter/m/a5b964/32.png) [@Matt\_Thrower](https://discuss.elastic.co/u/Matt_Thrower)\
**Post date:** [January 30, 2013, 2:45pm UTC](https://discuss.elastic.co/t/boost-value-behaviour/10551/6 "2013-01-30T14:45:13Z")

</div>

Brilliant, thanks. That nailed it!

On Wednesday, 30 January 2013 10:46:32 UTC, Clinton Gormley wrote:

> On Wed, 2013-01-30 at 02:37 -0800, Matt Thrower wrote:
> 
> > Also, I note that the boost _is_ added, but only after it's been  
> > normalised. So the relevant "explain" seems to get a score, add the  
> > normalised boost, and then multiply the total by a "coord" score (no  
> > idea where that comes from).
> 
> The coord is from a bool query (either used explicitly or auto-generated  
> by another query). Eg if you have:
> 
> { bool: {  
> must: [{...},{...},{...}]  
> }}
> 
> ie three clauses, then the coord will be 1/3. Each clause counts for  
> 1/3 of the total score.
> 
> You can disable\_coord in bool queries  
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/query-dsl/bool-query.html)
> 
> clint

--  
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:53am UTC](https://discuss.elastic.co/t/boost-value-behaviour/10551/7 "2017-07-06T02:53:55Z")

</div>


