【发布时间】:2016-03-23 02:15:10
【问题描述】:
我有一个查询可能适用于在所有字段中搜索以空格分隔的短语,并在下面进行部分匹配。此外,如果“Joh”的得分低于“John”或“John Do”的得分低于“John Doe”,则得分按预期工作
POST /user/_search
{
"query": {
"match": {
"_all": {
"query": "John Doe",
"operator": "or",
"fuzziness": 2,
"prefix_length": 1
}
}
}
}
我现在尝试在此查询之上添加一个层,它返回上面的结果,其中“州”字段必须是“加利福尼亚”。我在下面的实现返回了所需的结果,但现在当找到匹配项时,评分的名称为 score。例如 'Joh' where state = 'California' 返回与 'John Doe' where state = 'California' 相同的分数。为什么评分不再正常工作?任何解决方案将不胜感激。
GET /user/_search
{
"query": {
"filtered": {
"query": {
"match": {
"_all": {
"query": "John Doe",
"operator": "or"
},
"filter": {
"bool": {
"must": [
{
"term": {
"state": "California"
}
}
]
}
}
}
}
}
}
}
【问题讨论】:
标签: search elasticsearch filter boolean-logic scoring