【发布时间】:2018-10-19 09:39:59
【问题描述】:
您好,我正在尝试在不同的字段中搜索值。我正在使用 multi_match 和 cross_fields 类型。 这是查询
"query": {
"filtered": {
"query": {
"bool": {
"must": [
{
"multi_match": {
"query": "red cross",
"type": "cross_fields",
"fields": [
"name^20",
"keywords^12",
"description^1"
]
}
}
]
}
}
} }
上述查询得到的结果
"results": [
{
"name": "CrossPurpose",
.....
} ,
{
"name": "Community Center",
"keywords": "American Red Cross,Red Cross,Center,Blood",
. . .
},
{
"name": "Some Group",
"description":".... red cross ..."
},
.......
....
..
{
"name" : "Red cross" ,
.....
}
]
我想改进搜索结果。
我想在第一个位置查看名称为“Red cross”的记录。 首先它应该匹配整个单词 "red cross" 然后只匹配 "red" , "cross"。
我希望优先考虑名称字段而不是关键字和描述。
请帮助我改进查询。 提前致谢。
【问题讨论】:
标签: elasticsearch