我目前正在尝试写一个关于如何处理搜索的ElasticSearch查询。
现在,用我的代码:
{
"multi_match": {
"query": {searchTerm},
"fields": [
"first_name",
"last_name"
],
"type": "cross_fields",
"operator": "and"
}
}
如果searchTerm是'Example Bazz',则返回'Example Bazz'。但是,如果搜索词是“Example B”,我希望它返回“Example Bar,Example Bazz,Example Boo”。..'
有谁能帮助找出正确的查询,使查询字符串像多个字段的matchPrefix一样充当一个单词吗?
1条答案
按热度按时间vxqlmq5t1#
我做了这个例子。我猜这句话应该是在田野里您可以合并查询。我保留您的多匹配查询,并添加一个新的多匹配查询类型为“phrase_prefix”。