我有点怀疑你在刷屏

mapping将字段的analyzer设置为ik_smart,search_analyzer设置为ik_smart后,highlight不生效的问题

匿名 | 发布于2018年04月08日 | 阅读数:10007


{
    "mappings": {
        "_default_": {
            "properties": {
                "problemId": {
                    "include_in_all": false,
                    "index": true,
                    "type": "keyword"
                },
                "standardQuestion": {
                    "include_in_all": true,
                    "type": "text",
                    "fields": {
                      "keyword": {
                        "type": "keyword"
                      }
                    },
                    "analyzer": "ik_smart"
                },
                "smsAnswer": {
                   "include_in_all": true,
                    "type": "text",
                    "fields": {
                      "keyword": {
                        "type": "keyword"
                      }
                    },
                    "analyzer": "ik_smart"
                },
                "innerAnswer": {
                   "include_in_all": true,
                    "type": "text",
                    "fields": {
                      "keyword": {
                        "type": "keyword"
                      }
                    },
                    "analyzer": "ik_smart"
                },
               
                 "kmLikeAskList": {
                  "type": "object",
                "properties": {
                "askId": {
                    "include_in_all": false,
                    "index": true,
                    "type": "keyword"
                },
                "problemId": {
                    "include_in_all": false,
                    "index": true,
                    "type": "keyword"
                },
                "askQuestion": {
                    "include_in_all": true,
                    "type": "text",
                    "fields": {
                      "keyword": {
                        "type": "keyword"
                      }
                    },
                    "analyzer": "ik_smart"
                }
                }
                }
      
            }
        }
    },
    "_all": {
        "store": "false",
        "search_analyzer": "ik_smart",
        "analyzer": "ik_smart",
        "term_vector": "no"
    }
}
 
已邀请:

wuzx

赞同来自:

设置为ik_max_word时高亮返回是正常的,修改为ik_smart后没有返回highlight的内容  但实际是有对应的匹配值。

laoyang360 - 《一本书讲透Elasticsearch》作者,Elastic认证工程师 [死磕Elasitcsearch]知识星球地址:http://t.cn/RmwM3N9;微信公众号:铭毅天下; 博客:https://elastic.blog.csdn.net

赞同来自:

ik_smart是粗粒度检索,本身分词就会较细粒度max_word少。
你可以通过分词验证下你要的高亮字段smart分词是否存在?
验证方法:GET /ik_index/_analyze?analyzer=ik_smart
{
"text":"公路局正在治理解放大道路面积水问题"
}
text换成你的文档

要回复问题请先登录注册