Hello,World

输入"鼻子",要能查出包含"鼻"的内容,要怎么做?

Elasticsearch | 作者 gancl | 发布于2020年05月05日 | 阅读数:1133

在用ik之前是可以,但是会把光子也查出来了, 加入ik后, 就出现了这种情况了.
我的ik设置了ik_max_word和ik_smart都达不到效果.
http://172.30.1.12:9200/appproduct/_search
{
"query": {
"bool": {
"must": [
{
"match": {
"fname": "鼻子"
}
}
],
"must_not": [],
"should": []
}
},
"from": 0,
"size": 10,
"sort": [],
"aggs": {}
}
已邀请:

DRose

赞同来自:

有两种方式可以试试看:
①把子这个字设置为过滤词,那么IK分词鼻子,只会分出个鼻这个字,
②设置相似词的时候 鼻子 => 鼻,这样搜索鼻子的时候,实际搜的是鼻这个字

waywu

赞同来自:

GET index/_search
{
  "query": {
    "match": {
      "name":{
        "query": "鼻子",
        "fuzziness": 1
      }
    }
  }
}

Sinux

赞同来自:

edge_ngram 在 min_gram 为 1 的时候也可以切出来你想要的 term。

要回复问题请先登录注册