【发布时间】:2016-05-26 16:32:42
【问题描述】:
我想在我的 ONGR 设置中提升文档。如here 所示,最有效的方法是将其添加到映射中:
"boosting_field": {"type" : "integer", "store" : "yes", "index" : "yes", "boost" : 10.0,}
我如何在 ONGR 中做到这一点?
【问题讨论】:
标签: elasticsearch solr-boost ongr
我想在我的 ONGR 设置中提升文档。如here 所示,最有效的方法是将其添加到映射中:
"boosting_field": {"type" : "integer", "store" : "yes", "index" : "yes", "boost" : 10.0,}
我如何在 ONGR 中做到这一点?
【问题讨论】:
标签: elasticsearch solr-boost ongr
映射中索引时的提升字段为strongly discouraged,因为一旦设置,您将永远无法更改字段的提升。此外,这个功能甚至可能在未来的版本中被移除。
因此,您绝对应该使用查询时间提升,这是一种更灵活的方式来提升您的字段。
【讨论】:
如果您想在这种特殊情况boost 的映射中添加任何自定义字段,您可以通过选项来完成,请参见下面的示例:
//...
/**
* @ES\Property(type="string", options={"boost"="10"})
*/
public $title;
//...
【讨论】:
您必须避免在索引映射中使用 boost。相反,在搜索中尝试使用字段权重。例如
{
"query": {
"bool": {
"should": [
{
"term": {
"title": "acme^2"
}
},
{
"term": {
"description": "bar^1"
}
}
]
}
}
}
【讨论】: