ElasticSearch - 如何优先从同一行匹配

时间:2012-11-17 10:18:01

标签: lucene elasticsearch

我在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"}
                }
            }
        }
    }
}

问题:我现在正在搜索“爱尔兰塞特犬”,我需要在同一行中搜索字词的文档得分更高。

目前第二份文件得分为0.22,而第一份得分为0.14。

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

1 个答案:

答案 0 :(得分:1)

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

相关问题