【发布时间】:2019-03-12 07:49:11
【问题描述】:
我想按特定顺序获取结果,首先获取确切的短语 (match_phrase) 匹配,然后匹配短语中的任何单词 (match),例如,如果我正在搜索“我在哪里可以找到我的帐户”我将首先获取包含完整短语“where can I find my account”的文档,然后获取包含一个或多个单词“where”、“can”、“find”、“my”、“account”的文档
我的查询:
GET my_index/_search
{
"query": {
"bool": {
"should": [
{
"match": {"body": "right usage of Localization" }
} ,
{
"match": {"title": "right usage of Localization" }
}
],
"should": [
{
"match_phrase": {"body": "translated" }
},
{
"match_phrase": {"title": "translated" }
}
]
}
} }
【问题讨论】:
标签: elasticsearch