行动是治愈恐惧的良药,而犹豫、拖延将不断滋养恐惧。

使用ik分词器后,查询不出来关键词

Kibana | 作者 yudidi | 发布于2021年05月25日 | 阅读数:2223


PUT th_topic
{
"settings": {
"analysis": {
"analyzer": {
"ik_pinyin_analyzer":{
"char_filter":["html_strip"],
"tokenizer":"keyword",
"filter":["my_pinyin"]
}
},
"filter": {
"my_pinyin":{
"type":"pinyin",
"keep_full_pinyin":false,
"keep_joined_full_pinyin":true,
"keep_original":true,
"keep_none_chinese":false,
"keep_none_chinese_in_joined_full_pinyin":true
}
}
}
},
"mappings" : {
"properties" : {
"topicBrowseCount" : {
"type" : "long"
},
"userCode" : {
"type" : "keyword"
},
"topicCommentCount" : {
"type" : "long"
},
"createTime" : {
"type" : "date"
},
"topicContent" : {
"type" : "text",
"analyzer": "ik_max_word"
},
"topicId" : {
"type" : "long"
},
"topicLikeCount" : {
"type" : "long"
},
"topicCode" : {
"type" : "keyword"
},
"topicTitle" : {
"type" : "text",
"analyzer": "ik_max_word",
"search_analyzer": "ik_smart",
"fields" : {
"keyword" : {
"type" : "completion",
"analyzer" : "ik_pinyin_analyzer",
"search_analyzer": "keyword"
}
}
},
"updateTime" : {
"type" : "date"
},
"type":{
"type": "text",
"fields": {
"keyword":{
"type": "keyword"
}
}
}
}
}
}
创建的索引字段topicTitle使用了ik分词器,并且设置了扩展词 `题乎`,并且该索引下的数据包含有题乎的topicTitle,但是我在用DSL查询语句查询时,查不到任何结果,我的查询语句如下:
 
 
GET th_topic/_search
{
"query": {
"match": {
"topicTitle": "题乎"
}
}
}
得到的查询结果如下图
 
Snipaste_2021-05-25_16-21-40.png
已邀请:

要回复问题请先登录注册