I want to boost documents in my ONGR setup. As show here the most efficiant way to do so, is by adding it to the mapping:
"boosting_field": {"type" : "integer", "store" : "yes", "index" : "yes", "boost" : 10.0,}
How can i do that in ONGR?
I want to boost documents in my ONGR setup. As show here the most efficiant way to do so, is by adding it to the mapping:
"boosting_field": {"type" : "integer", "store" : "yes", "index" : "yes", "boost" : 10.0,}
How can i do that in ONGR?
Boosting fields at index time in the mapping is strongly discouraged because once set you can never change the boost of your field. Moreover this feature might even be removed in future versions.
So you should definitely go for query-time boosting, which is a much more flexible way to boost your fields.
If you want to add any custom field to the mapping in this particular case boost
, you can do it via options, see the example below:
//...
/**
* @ES\Property(type="string", options={"boost"="10"})
*/
public $title;
//...
You definitely have to avoid using boost in the index mapping. Instead, in the search try to use field weights. e.g.
{
"query": {
"bool": {
"should": [
{
"term": {
"title": "acme^2"
}
},
{
"term": {
"description": "bar^1"
}
}
]
}
}
}