我刚打酱油去了,不好意思

es安装分词器插件hanlp之后并不能用

Elasticsearch | 作者 fateyhl | 发布于2019年12月05日 | 阅读数:2894

报错如下:
{
"error": {
"root_cause": [
{
"type": "remote_transport_exception",
"reason": "[node45-1][ip:9300][indices:admin/analyze[s]]"
}
],
"type": "illegal_argument_exception",
"reason": "failed to find analyzer [hanlp-index]"
},
"status": 400
};
已邀请:

wenjian

赞同来自:



Fisher - 鱼仔

赞同来自:

先看下hanlp插件注册名字是不是 hanlp-index

curl -XGET 'http://<ip>:<port>/_analyze?pretty&analyzer=hanlp-index' -H 'Content-Type: application/json' -d ' { "text": [ "分词测试" ] } '

直接测一下

liuxg - Elastic

赞同来自:

我刚才在Elasticsearch 7.4.2的安装中安装了Hanlp。 我这里没有看到任何的问题啊。按照文档中的例子,显示的结果是:
{
  "tokens" : [
    {
      "token" : "美国",
      "start_offset" : 0,
      "end_offset" : 2,
      "type" : "nsf",
      "position" : 0
    },
    {
      "token" : "阿拉斯加州",
      "start_offset" : 2,
      "end_offset" : 7,
      "type" : "nsf",
      "position" : 1
    },
    {
      "token" : "发生",
      "start_offset" : 7,
      "end_offset" : 9,
      "type" : "v",
      "position" : 2
    },
    {
      "token" : "8.0",
      "start_offset" : 9,
      "end_offset" : 12,
      "type" : "m",
      "position" : 3
    },
    {
      "token" : "级",
      "start_offset" : 12,
      "end_offset" : 13,
      "type" : "q",
      "position" : 4
    },
    {
      "token" : "地震",
      "start_offset" : 13,
      "end_offset" : 15,
      "type" : "n",
      "position" : 5
    }
  ]
}
 
你有没有使用如下的命令检查安装是否成功:
$ ./bin/elasticsearch-plugin list

analysis-hanlp
 
如果安装成功的话,就会显示有上面的结果。
另外安装后,必须重新启动Elasticsearch才可以起作用。
 

要回复问题请先登录注册