在elasticsearch中提升特定文档中的特定单词

时间:2017-01-28 08:34:59

标签: elasticsearch

如何在弹性搜索中增加特定文档中的特定单词?

例如,在以下文件中,我想提高" goodwords"使用根据用户搜索日志和结果点击计算的权重字段的字段。

** Document 1 **
{
    "title": "divergent",
    "year": "2014",
    "goodwords": [
        { "word": "scifi", "weight": 1.5 },
        { "word": "future", "weight": 1.1 }
    ]
}

** Document 2 **
{
    "title": "insurgent",
    "year": "2015",
    "goodwords": [
        { "word": "scifi", "weight": 0.8 },
        { "word": "future", "weight": 1.5 },
        { "word": "fiction", "weight": 1.8 }
    ]
}

1 个答案:

答案 0 :(得分:0)

对于上面提到的查询,我们有查询时间提升和索引时间提升。大多数情况下查询时间提升与索引时间提升相比。 对于上述情况,您需要更改映射。所以我会为您提供链接,如果您有任何问题,请告诉我。

请参阅Elasticsearch文档中的boost mapping parameter