在使用Elasticsearch搜索相似文本时,如何赋予特定关键字更多的权重?

时间:2019-07-31 01:27:25

标签: elasticsearch elasticsearch-plugin

我正在使用Elasticsearch从文章数据库中获取相关博客文章。我希望包含特定单词的搜索结果比没有搜索结果的搜索结果得分更高。

我尝试添加停用词,并在其他字段中添加了更多内容,但结果与预期不符。我正在使用elasticsearch的Kibana界面的开发人员模式

“”“

GET blog-desc/_search
{
    "query": {
        "more_like_this" : {
            "fields" : ["Meta description","Title^5", 
            "Short title^0.5"],
            "like" : "Harry had a silver wand he likes to play with! Among his friends he has the most expensive one. The only difference between his wand and his sister's is that in the color",
            "min_term_freq" : 1,
            "max_query_terms" : 12, 
            "minimum_should_match": "30%", 
            "stop_words": ["difference", "play", "among"]
            , "boost_terms": 1
        }
    }
}

“”“ 在上面的示例代码中,我希望搜索结果中包含“ silver”作为单词的单词比没有该单词的其他文章获得更高的得分。

0 个答案:

没有答案