# Document boost

**URL:** https://discuss.elastic.co/t/document-boost/9096
**Category:** Elasticsearch
**Created:** [September 21, 2012, 2:23pm UTC](https://discuss.elastic.co/t/document-boost/9096 "2012-09-21T14:23:19Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Ayrton\_Araujo](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ayrton_araujo/32/2711_2.png) [@Ayrton\_Araujo](https://discuss.elastic.co/u/Ayrton_Araujo)
#### Post date: [September 21, 2012, 2:23pm UTC](https://discuss.elastic.co/t/document-boost/9096/1 "2012-09-21T14:23:19Z")

</div>

I'm looking in the documentation about how to boost a document when  
indexing. But I can't find a way to do that.  
Is that possible?

If yes, how to do this?

--

---

<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: [September 21, 2012, 2:27pm UTC](https://discuss.elastic.co/t/document-boost/9096/2 "2012-09-21T14:27:27Z")

</div>

On Fri, 2012-09-21 at 07:23 -0700, Ayrton Araújo wrote:

> I'm looking in the documentation about how to boost a document when  
> indexing. But I can't find a way to do that.  
> Is that possible?

Have a look at the boost field:

> **[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

--

---

<div class="post-metadata">

### Author: ![Ayrton\_Araujo](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ayrton_araujo/32/2711_2.png) [@Ayrton\_Araujo](https://discuss.elastic.co/u/Ayrton_Araujo)
#### Post date: [September 21, 2012, 2:43pm UTC](https://discuss.elastic.co/t/document-boost/9096/3 "2012-09-21T14:43:28Z")

</div>

I'm trying to do this in that way:  
[https://gist.github.com/3761823](https://gist.github.com/3761823)

But it not working.

--

---

<div class="post-metadata">

### Author: ![Ayrton\_Araujo](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ayrton_araujo/32/2711_2.png) [@Ayrton\_Araujo](https://discuss.elastic.co/u/Ayrton_Araujo)
#### Post date: [September 21, 2012, 2:58pm UTC](https://discuss.elastic.co/t/document-boost/9096/4 "2012-09-21T14:58:57Z")

</div>

Thank you, Clinton.

Actually it appears to be a wild bug:

> <https://github.com/elastic/elasticsearch/issues/2277>
>
> A \`match\_all\` query should take the value stored in the norms field into account…, but it ignores it, even when the \`norms\_field\` is specified in the query:
> 
> \`\`\`
> curl -XPUT 'http://127.0.0.1:9200/test/?pretty=1' -d '
> {
> "mappings" : {
> "test" : {
> "\_boost" : {
> "null\_value" : 1,
> "name" : "boost"
> }
> }
> }
> }
> '
> 
> curl -XPUT 'http://127.0.0.1:9200/test/test/1?pretty=1' -d '
> {
> "text" : "foo",
> "boost" : 1
> }
> '
> 
> curl -XPUT 'http://127.0.0.1:9200/test/test/2?pretty=1' -d '
> {
> "text" : "foo",
> "boost" : 2
> }
> '
> 
> curl -XPOST 'http://127.0.0.1:9200/test/\_refresh?pretty=1' 
> \`\`\`
> 
> The \`match\_all\` gets translated to a constant score query, ignoring the norms field:
> 
> \`\`\`
> curl -XGET 'http://127.0.0.1:9200/test/test/\_search?pretty=1' -d '
> {
> "query" : {
> "match\_all" : {
> "norms\_field" : "boost"
> }
> },
> "explain" : 1
> }
> '
> 
> \# \[Fri Sep 21 16:48:10 2012\] Response:
> \# {
> \# "hits" : {
> \# "hits" : \[
> \# {
> \# "\_source" : {
> \# "boost" : 1,
> \# "text" : "foo"
> \# },
> \# "\_score" : 1,
> \# "\_index" : "test",
> \# "\_shard" : 2,
> \# "\_id" : "1",
> \# "\_node" : "BdOHDT8FT6yMecrZDzpkHA",
> \# "\_type" : "test",
> \# "\_explanation" : {
> \# "value" : 1,
> \# "details" : \[
> \# {
> \# "value" : 1,
> \# "description" : "boost"
> \# },
> \# {
> \# "value" : 1,
> \# "description" : "queryNorm"
> \# }
> \# \],
> \# "description" : "ConstantScore(NotDeleted(cache(\_type:test))), product of:"
> \# }
> \# },
> \# {
> \# "\_source" : {
> \# "boost" : 2,
> \# "text" : "foo"
> \# },
> \# "\_score" : 1,
> \# "\_index" : "test",
> \# "\_shard" : 3,
> \# "\_id" : "2",
> \# "\_node" : "BdOHDT8FT6yMecrZDzpkHA",
> \# "\_type" : "test",
> \# "\_explanation" : {
> \# "value" : 1,
> \# "details" : \[
> \# {
> \# "value" : 1,
> \# "description" : "boost"
> \# },
> \# {
> \# "value" : 1,
> \# "description" : "queryNorm"
> \# }
> \# \],
> \# "description" : "ConstantScore(NotDeleted(cache(\_type:test))), product of:"
> \# }
> \# }
> \# \],
> \# "max\_score" : 1,
> \# "total" : 2
> \# },
> \# "timed\_out" : false,
> \# "\_shards" : {
> \# "failed" : 0,
> \# "successful" : 5,
> \# "total" : 5
> \# },
> \# "took" : 3
> \# }
> \`\`\`
> 
> The norms field is taken into account on other queris:
> 
> \`\`\`
> curl -XGET 'http://127.0.0.1:9200/test/test/\_search?pretty=1' -d '
> {
> "query" : {
> "text" : {
> "text" : "foo"
> }
> },
> "explain" : 1
> }
> '
> 
> \# {
> \# "hits" : {
> \# "hits" : \[
> \# {
> \# "\_source" : {
> \# "boost" : 2,
> \# "text" : "foo"
> \# },
> \# "\_score" : 0.61370564,
> \# "\_index" : "test",
> \# "\_shard" : 3,
> \# "\_id" : "2",
> \# "\_node" : "BdOHDT8FT6yMecrZDzpkHA",
> \# "\_type" : "test",
> \# "\_explanation" : {
> \# "value" : 0.61370564,
> \# "details" : \[
> \# {
> \# "value" : 1,
> \# "description" : "tf(termFreq(text:foo)=1)"
> \# },
> \# {
> \# "value" : 0.30685282,
> \# "description" : "idf(docFreq=1, maxDocs=1)"
> \# },
> \# {
> \# "value" : 2,
> \# "description" : "fieldNorm(field=text, doc=0)"
> \# }
> \# \],
> \# "description" : "fieldWeight(text:foo in 0), product of:"
> \# }
> \# },
> \# {
> \# "\_source" : {
> \# "boost" : 1,
> \# "text" : "foo"
> \# },
> \# "\_score" : 0.30685282,
> \# "\_index" : "test",
> \# "\_shard" : 2,
> \# "\_id" : "1",
> \# "\_node" : "BdOHDT8FT6yMecrZDzpkHA",
> \# "\_type" : "test",
> \# "\_explanation" : {
> \# "value" : 0.30685282,
> \# "details" : \[
> \# {
> \# "value" : 1,
> \# "description" : "tf(termFreq(text:foo)=1)"
> \# },
> \# {
> \# "value" : 0.30685282,
> \# "description" : "idf(docFreq=1, maxDocs=1)"
> \# },
> \# {
> \# "value" : 1,
> \# "description" : "fieldNorm(field=text, doc=0)"
> \# }
> \# \],
> \# "description" : "fieldWeight(text:foo in 0), product of:"
> \# }
> \# }
> \# \],
> \# "max\_score" : 0.61370564,
> \# "total" : 2
> \# },
> \# "timed\_out" : false,
> \# "\_shards" : {
> \# "failed" : 0,
> \# "successful" : 5,
> \# "total" : 5
> \# },
> \# "took" : 3
> \# }
> \`\`\`

Em sexta-feira, 21 de setembro de 2012 10h27min42s UTC-4, Clinton Gormley  
escreveu:

> On Fri, 2012-09-21 at 07:23 -0700, Ayrton Araújo wrote:
> 
> > I'm looking in the documentation about how to boost a document when  
> > indexing. But I can't find a way to do that.  
> > Is that possible?
> 
> Have a look at the boost field:  
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/mapping/boost-field.html)
> 
> clint

--

---

<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, 3:11am UTC](https://discuss.elastic.co/t/document-boost/9096/5 "2017-07-06T03:11:58Z")

</div>


