【发布时间】:2012-09-07 18:59:58
【问题描述】:
需要在 ElasticSearch 中找到一种方法,以根据字段的特定值提高文档的相关性。具体来说,在我的所有文档中都有一个特殊字段,字段值越高,包含它的文档应该越相关,无论搜索如何。
考虑以下文档结构:
{
"_all" : {"enabled" : "true"},
"properties" : {
"_id": {"type" : "string", "store" : "yes", "index" : "not_analyzed"},
"first_name": {"type" : "string", "store" : "yes", "index" : "yes"},
"last_name": {"type" : "string", "store" : "yes", "index" : "yes"},
"boosting_field": {"type" : "integer", "store" : "yes", "index" : "yes"}
}
}
我希望 boosting_field 值较高的文档比 boosting_field 值较低的文档在本质上更相关。这只是一个起点——在确定搜索中每个文档的最终相关性分数时,还将考虑查询与其他字段之间的匹配。但是,在其他条件相同的情况下,提升字段越高,文档的相关性越高。
有人知道怎么做吗?
非常感谢!
【问题讨论】:
-
另请参阅stackoverflow.com/a/41813578/5444623,了解按文档类型字段进行的不同提升
标签: search elasticsearch