# Field is not being boosted

**URL:** <https://discuss.elastic.co/t/field-is-not-being-boosted/13349>\
**Category:** Elasticsearch\
**Created:** [August 27, 2013, 3:56pm UTC](https://discuss.elastic.co/t/field-is-not-being-boosted/13349 "2013-08-27T15:56:13Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![designermonkey](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/designermonkey/32/2035_2.png) [@designermonkey](https://discuss.elastic.co/u/designermonkey)\
**Post date:** [August 27, 2013, 3:56pm UTC](https://discuss.elastic.co/t/field-is-not-being-boosted/13349/1 "2013-08-27T15:56:13Z")

</div>

I'm having a real problem getting a field to be boosted, and with a boss  
breathing down my neck, I'm struggling to find any resources to help  
explain why.

I have a document boost being applied based on a logic gate; it would be  
3000 from one possible result, or 5000 from another. This is to ensure that  
documents of a certain type are pushed to the top of the results list.

The 'recipes' documents then have a boost being applied to the 'title'  
field, so that if the search term appears in the title, and the  
ingredients, then the title based results return higher than those with  
ingredients. This ensures for me that if the term appears three times in  
the ingredients, any results with the term in the title will still appear  
above them.

It's this title boost that isn't happening, and I can't figure out why. I  
have used 'explain: true' yet it makes absolutely no sense to me at all.

My recipes mapping is:

{  
"recipes": {  
"properties": {  
"title": {  
"boost": 1000,  
"type": "string",  
"index": "analyzed",  
"analyzer": "nigella\_fulltext"  
},  
"url": {  
"type": "string",  
"index": "no",  
"include\_in\_all": false  
},  
"introduction": {  
"type": "string",  
"index": "no",  
"include\_in\_all": false  
},  
"ingredients": {  
"properties": {  
"title": {  
"type": "string",  
"index": "analyzed"  
}  
}  
}  
}  
}  
}

For the document based boost, the \_boost is applied by PHP while making  
the data up for each document. Normally, there will only be a document  
boost of '3000' or none, as the other part of the logic gate that supplies  
'5000' has no response yet.

The query I use is:

{  
"explain":true,  
"query":{  
"query\_string":{  
"query":"chicken",  
"default\_operator":"AND",  
"fields":["\_all"]  
}  
},  
"sort":{"\_score":"desc"},  
"facets":{  
"filtered\_sections":{  
"terms":{"field":"\_type"}  
}  
},  
"highlight":{  
"fields":{  
"title":{},  
"introduction":{},  
"servings":{},  
"ingredients.title":{},  
"moods.title":{},  
"occasions.title":{}  
},  
"encoder":"html",  
"fragment\_size":200,  
"number\_of\_fragments":1,  
"pre\_tags":["\<strong class="highlight"\>"],  
"post\_tags":[""]  
},  
"filter":{  
"terms":{  
"\_type":["recipes"]  
}  
}  
}

Many results have a boost of 3000, as the scores are, for example: 3402,  
3138 etc etc. Problem is that There are loads of 'titles' that have the  
search term in, and yet a result that doesn't is coming up above them.

Can anyone help out here? I can give private access to the development  
index if needed, as I'm really under the kosh to get this fixed.

Thanks in advance,

John

--  
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:** ![Ivan](https://avatars.discourse-cdn.com/v4/letter/i/df788c/32.png) [@Ivan](https://discuss.elastic.co/u/Ivan)\
**Post date:** [August 27, 2013, 4:13pm UTC](https://discuss.elastic.co/t/field-is-not-being-boosted/13349/2 "2013-08-27T16:13:48Z")

</div>

You are querying the \_all field, which has no boost. Trying using a multi  
match query on the title/ingredients fields and specifying the field boosts  
in the 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.

Cheers,

Ivan

On Tue, Aug 27, 2013 at 8:56 AM, John Porter [john@designermonkey.co.uk](mailto:john@designermonkey.co.uk)wrote:

> I'm having a real problem getting a field to be boosted, and with a boss  
> breathing down my neck, I'm struggling to find any resources to help  
> explain why.
> 
> I have a document boost being applied based on a logic gate; it would be  
> 3000 from one possible result, or 5000 from another. This is to ensure that  
> documents of a certain type are pushed to the top of the results list.
> 
> The 'recipes' documents then have a boost being applied to the 'title'  
> field, so that if the search term appears in the title, and the  
> ingredients, then the title based results return higher than those with  
> ingredients. This ensures for me that if the term appears three times in  
> the ingredients, any results with the term in the title will still appear  
> above them.
> 
> It's this title boost that isn't happening, and I can't figure out why. I  
> have used 'explain: true' yet it makes absolutely no sense to me at all.
> 
> My recipes mapping is:
> 
> {  
> "recipes": {  
> "properties": {  
> "title": {  
> "boost": 1000,  
> "type": "string",  
> "index": "analyzed",  
> "analyzer": "nigella\_fulltext"  
> },  
> "url": {  
> "type": "string",  
> "index": "no",  
> "include\_in\_all": false  
> },  
> "introduction": {  
> "type": "string",  
> "index": "no",  
> "include\_in\_all": false  
> },  
> "ingredients": {  
> "properties": {  
> "title": {  
> "type": "string",  
> "index": "analyzed"  
> }  
> }  
> }  
> }  
> }  
> }
> 
> For the document based boost, the \_boost is applied by PHP while making  
> the data up for each document. Normally, there will only be a document  
> boost of '3000' or none, as the other part of the logic gate that supplies  
> '5000' has no response yet.
> 
> The query I use is:
> 
> {  
> "explain":true,  
> "query":{  
> "query\_string":{  
> "query":"chicken",  
> "default\_operator":"AND",  
> "fields":["\_all"]  
> }  
> },  
> "sort":{"\_score":"desc"},  
> "facets":{  
> "filtered\_sections":{  
> "terms":{"field":"\_type"}  
> }  
> },  
> "highlight":{  
> "fields":{  
> "title":{},  
> "introduction":{},  
> "servings":{},  
> "ingredients.title":{},  
> "moods.title":{},  
> "occasions.title":{}  
> },  
> "encoder":"html",  
> "fragment\_size":200,  
> "number\_of\_fragments":1,  
> "pre\_tags":["\<strong class="highlight"\>"],  
> "post\_tags":[""]  
> },  
> "filter":{  
> "terms":{  
> "\_type":["recipes"]  
> }  
> }  
> }
> 
> Many results have a boost of 3000, as the scores are, for example: 3402,  
> 3138 etc etc. Problem is that There are loads of 'titles' that have the  
> search term in, and yet a result that doesn't is coming up above them.
> 
> Can anyone help out here? I can give private access to the development  
> index if needed, as I'm really under the kosh to get this fixed.
> 
> Thanks in advance,
> 
> John
> 
> --  
> 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:** ![designermonkey](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/designermonkey/32/2035_2.png) [@designermonkey](https://discuss.elastic.co/u/designermonkey)\
**Post date:** [August 27, 2013, 4:35pm UTC](https://discuss.elastic.co/t/field-is-not-being-boosted/13349/3 "2013-08-27T16:35:27Z")

</div>

Thank you so much for letting me know that! That actually makes a lot of  
sense now I read it.

I will definitely give that query a go. It's a shame there aren't any  
decent tutorials out there to explain this stuff better.

Thanks,

John.

On Tuesday, 27 August 2013 17:13:48 UTC+1, Ivan Brusic wrote:

> You are querying the \_all field, which has no boost. Trying using a multi  
> match query on the title/ingredients fields and specifying the field boosts  
> in the query.
> 
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/query-dsl/multi-match-query/)
> 
> Cheers,
> 
> Ivan
> 
> On Tue, Aug 27, 2013 at 8:56 AM, John Porter \<[jo...@designermonkey.co.uk](mailto:jo...@designermonkey.co.uk)\<javascript:\>
> 
> > wrote:
> 
> > I'm having a real problem getting a field to be boosted, and with a boss  
> > breathing down my neck, I'm struggling to find any resources to help  
> > explain why.
> > 
> > I have a document boost being applied based on a logic gate; it would be  
> > 3000 from one possible result, or 5000 from another. This is to ensure that  
> > documents of a certain type are pushed to the top of the results list.
> > 
> > The 'recipes' documents then have a boost being applied to the 'title'  
> > field, so that if the search term appears in the title, and the  
> > ingredients, then the title based results return higher than those with  
> > ingredients. This ensures for me that if the term appears three times in  
> > the ingredients, any results with the term in the title will still appear  
> > above them.
> > 
> > It's this title boost that isn't happening, and I can't figure out why. I  
> > have used 'explain: true' yet it makes absolutely no sense to me at all.
> > 
> > My recipes mapping is:
> > 
> > {  
> > "recipes": {  
> > "properties": {  
> > "title": {  
> > "boost": 1000,  
> > "type": "string",  
> > "index": "analyzed",  
> > "analyzer": "nigella\_fulltext"  
> > },  
> > "url": {  
> > "type": "string",  
> > "index": "no",  
> > "include\_in\_all": false  
> > },  
> > "introduction": {  
> > "type": "string",  
> > "index": "no",  
> > "include\_in\_all": false  
> > },  
> > "ingredients": {  
> > "properties": {  
> > "title": {  
> > "type": "string",  
> > "index": "analyzed"  
> > }  
> > }  
> > }  
> > }  
> > }  
> > }
> > 
> > For the document based boost, the \_boost is applied by PHP while making  
> > the data up for each document. Normally, there will only be a document  
> > boost of '3000' or none, as the other part of the logic gate that supplies  
> > '5000' has no response yet.
> > 
> > The query I use is:
> > 
> > {  
> > "explain":true,  
> > "query":{  
> > "query\_string":{  
> > "query":"chicken",  
> > "default\_operator":"AND",  
> > "fields":["\_all"]  
> > }  
> > },  
> > "sort":{"\_score":"desc"},  
> > "facets":{  
> > "filtered\_sections":{  
> > "terms":{"field":"\_type"}  
> > }  
> > },  
> > "highlight":{  
> > "fields":{  
> > "title":{},  
> > "introduction":{},  
> > "servings":{},  
> > "ingredients.title":{},  
> > "moods.title":{},  
> > "occasions.title":{}  
> > },  
> > "encoder":"html",  
> > "fragment\_size":200,  
> > "number\_of\_fragments":1,  
> > "pre\_tags":["\<strong class="highlight"\>"],  
> > "post\_tags":[""]  
> > },  
> > "filter":{  
> > "terms":{  
> > "\_type":["recipes"]  
> > }  
> > }  
> > }
> > 
> > Many results have a boost of 3000, as the scores are, for example: 3402,  
> > 3138 etc etc. Problem is that There are loads of 'titles' that have the  
> > search term in, and yet a result that doesn't is coming up above them.
> > 
> > Can anyone help out here? I can give private access to the development  
> > index if needed, as I'm really under the kosh to get this fixed.
> > 
> > Thanks in advance,
> > 
> > John
> > 
> > --  
> > 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:** ![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:19am UTC](https://discuss.elastic.co/t/field-is-not-being-boosted/13349/4 "2017-07-06T02:19:31Z")

</div>


