【发布时间】:2018-02-01 17:02:31
【问题描述】:
我正在尝试使用 ElasticSearch 对字符串字段执行短语搜索,但我并不真正理解返回结果的顺序。我有一个简单的“match_phrase”查询形式:
GET /MyIndex/_search
{
"query":
{
"match_phrase":
{
"FieldToSearch": "find this phrase"
}
}
}
假设我的文档包含以下“FieldToSearch”值:["This is the way to find this phrase", "find this phrase", "find this phrase to win a prize"]。我希望它在其他 2 个结果之前返回 "find this phrase",因为它与我正在寻找的短语完全匹配。但是,我注意到它有时会首先列出 "find this phrase to win a prize" 之类的内容。有没有办法在包含完全匹配的结果之前返回“完全匹配”?
【问题讨论】:
标签: elasticsearch