作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在使用query_string
,并且我希望我的搜索能够容忍错别字。在下面的查询中,我键入了The Gren Mile
,但是没有返回任何结果:
curl -XPOST 127.0.0.1:9200/test
curl -XPOST 127.0.0.1:9200/test/movies -d '{"title": "The Green Mile"}'
curl -XPOST 127.0.0.1:9200/test/_refresh
curl -XPOST 127.0.0.1:9200/test/movies/_search -d '{
"query": {
"query_string": {
"query": "The Gren Mile",
"default_operator": "AND"
}
}
}'
fuzziness
是
AUTO
(随着单词的变大,它可以容忍更大的错字),所以我不知道为什么它不起作用。我尝试手动设置
fuzziness: 2
,但是它也不起作用。这个选项会做我想不到的事情吗?
最佳答案
对于模糊性参数为何不起作用,我没有任何答案-它对我也不起作用,可能这是一个错误?
但是,将模糊运算符~
直接放在字符串中可以起作用:
curl -XPOST 127.0.0.1:9200/test/movies/_search?pretty -d '{
"query": {
"query_string": {
"query": "The Gren~ Mile",
"default_operator": "AND"
}
}
}'
{
"took" : 6,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"failed" : 0
},
"hits" : {
"total" : 1,
"max_score" : 0.263573,
"hits" : [ {
"_index" : "test",
"_type" : "movies",
"_id" : "AUxq8KE1EKExB5CrkB_W",
"_score" : 0.263573,
"_source":{"title": "The Green Mile"}
} ]
}
}
"query": {
"match": {
"title": {
"query": "The Gren Mile",
"operator" : "and",
"fuzziness": 2
}
}
}
关于elasticsearch - 如何容忍Elasticsearch的错字?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29344328/
好像JSlint最近添加了这个选项: “在/RegExp/中容忍 . 和 [^...]”。 为什么在正则表达式中使用 . 或 ^ 不好? 最佳答案 来自 the JSLint documentatio
我使用 wsimport 从特定的 WSDL 生成代码。我尝试了Java 10,握手失败,然后我尝试了Java 9,还可以。 我使用 wireshark 观察了通信,原因很清楚,我通信的服务器仍然使用
您能推荐一种设计模式/方法来暴露/容忍/从系统错误中恢复,异常处理(Java,C++,Perl,PHP)吗? 一些错误需要报告。 某些错误可以在内部处理(通过重试或无关紧要(可以忽略))。 您如何构造
我是一名优秀的程序员,十分优秀!