Lucene ElasticSearch-如何为同一行中的匹配赋予优先级
我在ElasticSearch 0.19.11中使用以下文档:Lucene ElasticSearch-如何为同一行中的匹配赋予优先级,lucene,elasticsearch,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": "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”。如何做到这一点?通过ElasticSearch谷歌集团成员的大力合作,找到了解决方案。 以下是讨论的链接: