Lit*_*ild 3 lucene elasticsearch
{
"title" : "That Uselessly Amazing Title",
"author" : "Someone you have never heard of",
"url" : "http://www.theuselessweb.com",
"summary" : "a collection of useless websites",
"tag" : ["useless","maybe useful"]
}
Run Code Online (Sandbox Code Playgroud)
假设我有一个类似于上面所示的架构。用户要求应用程序显示一些“无用”的内容。
如何编写一个查询,通过标题、摘要和标签来查找“无用”一词作为模糊搜索?
来自文档模糊匹配查询
\n\nGET /my_index/my_type/_search\n{\n "query": {\n "multi_match": {\n "fields": [ "summary", "title", "tag" ],\n "query": "useless",\n "fuzziness": "AUTO"\n }\n }\n}\nRun Code Online (Sandbox Code Playgroud)\n\n该查询之所以有效,是因为它使用了multi_match查询
\n\n\n模糊性仅适用于基本查询
\nmatch和multi_match查询。它\n 不\xe2\x80\x99 不能用于短语匹配、常用术语或cross_fields\n 匹配。
否则,您将不得不将多个查询组合fuzzy在一个bool在一个查询
| 归档时间: |
|
| 查看次数: |
6735 次 |
| 最近记录: |