0

我在 ElasticSearch 0.19.11 中有以下文档,使用:

{ "title": "dogs species",
    "col_names": [ "name", "description", "country_of_origin" ],
    "rows": [
        { "row": [ "Boxer", "good dog", "Germany" ] },
        { "row": [ "Irish Setter", "great dog", "Ireland" ] }
    ]
}
{ "title": "Misc stuff",
    "col_names": [ "foo" ],
    "rows": [
        { "row":    [ "Setter is impotant" ] },
        { "row":     [ "Ireland is green" ] }
    ]
}

映射如下:

{
    "table" : {
        "properties" : {
            "title" : {"type" : "string"},
            "col_names" : {"type" : "string"},
            "rows" : {
                "properties" : {
                    "row" : {"type" : "string"}
                }
            }
        }
    }
}

问题:我现在正在搜索“Ireland Setter”,对于在同一行中包含搜索词的文档,我需要获得更高的分数。

目前第二个文档得分为 0.22,而第一个文档得分为 0.14。

在这种情况下,我希望第一个文档获得更高的分数,因为它在同一行中同时包含“Ireland”和“Setter”。如何做呢?

4

1 回答 1

1

在 ElasticSearch google-group 成员的大力合作下,找到了解决方案。这是讨论的链接:https ://groups.google.com/forum/?fromgroups#!topic/elasticsearch/4O9dff2SNhg

于 2012-11-18T08:16:06.313 回答