动态

详情 返回 返回

ElasticSearch9.1.0版本配置IK分詞器插件時報錯:null_pointer_exception - 动态 详情

結論先行:

ElasticSearch的IK分詞器插件文件夾名稱,嚴格要求使用 analysis-ik 。

報錯信息:

    <!--用户可以在這裏配置遠程擴展字典 -->
    <entry key="remote_ext_dict">***</entry>
    <!--用户可以在這裏配置遠程擴展停止詞字典-->
    <entry key="remote_ext_stopwords">***</entry>

當在9.1.0版本中使用網絡擴展分詞功能時,報錯:

{
  "error" : {
    "root_cause" : [
      {
        "type" : "null_pointer_exception",
        "reason" : "Cannot invoke \"org.wltea.analyzer.dic.DictSegment.match(char[], int, int)\" because \"org.wltea.analyzer.dic.Dictionary.singleton._StopWords\" is null"
      }
    ],
    "type" : "null_pointer_exception",
    "reason" : "Cannot invoke \"org.wltea.analyzer.dic.DictSegment.match(char[], int, int)\" because \"org.wltea.analyzer.dic.Dictionary.singleton._StopWords\" is null"
  },
  "status" : 500
}

排查過程:

1. 到github上查找issue

https://github.com/infinilabs/analysis-ik/issues/1104
但是沒有找到真正的解決辦法

2. 查看readme文檔時有個細節:

Config file IKAnalyzer.cfg.xml can be located at {conf}/analysis-ik/config/IKAnalyzer.cfg.xml or {plugins}/elasticsearch-analysis-ik-*/config/IKAnalyzer.cfg.xml
文中在插件目錄中將文件夾命名為:analysis-ik , 而我的命名為 ik。

於是嘗試 修改插件文件名,並且重啓docker-compose。發現問題解決。

user avatar dewujishu 头像 huifeideniao 头像 sysin 头像 weirdo_67190d70053aa 头像
点赞 4 用户, 点赞了这篇动态!
点赞

Add a new 评论

Some HTML is okay.