Field is not being boosted

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.
For more options, visit https://groups.google.com/groups/opt_out.

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.

Cheers,

Ivan

On Tue, Aug 27, 2013 at 8:56 AM, John Porter john@designermonkey.co.ukwrote:

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.
For more options, visit 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.
For more options, visit https://groups.google.com/groups/opt_out.

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

Cheers,

Ivan

On Tue, Aug 27, 2013 at 8:56 AM, John Porter <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 <javascript:>.
For more options, visit 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.
For more options, visit https://groups.google.com/groups/opt_out.