elasticsearch 8.x 插件安装(六)之Hanlp插件

elasticsearch 8.x 插件安装(六)之Hanlp插件

elasticsearch插件安装合集

elasticsearch插件安装(一)之ik分词器安装(含MySQL更新)

elasticsearch 8.x插件(二)之同义词安装如何解决jdk权限问题

elasticsearch插件安装(二)之dynamic-synonym插件

elasticsearch 8.x 插件安装(三)之拼音插件

elasticsearch 8.x 插件安装(四)之简繁体插件

es 分词器(五)之elasticsearch-analysis-jieba 8.7.0

elasticsearch 8.x 插件安装(六)之Hanlp插件

一、拉取代码

代码地址:https://gitee.com/bubaiwantong/elasticsearch-analysis-hanlp

image-20241028124326785

二、打包插件

打开pom文件,将elasticsearch.version修改需要的版本,此处修改为8.7.0。

image-20241028124342073

在target/release目录找到与之版本对应的压缩包。

image-20241028124426764

三、安装插件

将压缩包解压至es plugins目录下并重启es

image-20241028124603961

四、验证插件

POST http://localhost:9200/twitter2/_analyze?analyzer=hanlp&pretty=true&text=美国阿拉斯加州发生8.0级地震
{
    
    
  "tokens" : [
    {
    
    
      "token" : "美国",
      "start_offset" : 0,
      "end_offset" : 2,
      "type" : "nsf",
      "position" : 0
    },
    {
    
    
      "token" : "阿拉斯加州",
      "start_offset" : 0,
      "end_offset" : 5,
      "type" : "nsf",
      "position" : 1
    },
    {
    
    
      "token" : "发生",
      "start_offset" : 0,
      "end_offset" : 2,
      "type" : "v",
      "position" : 2
    },
    {
    
    
      "token" : "8.0",
      "start_offset" : 0,
      "end_offset" : 3,
      "type" : "m",
      "position" : 3
    },
    {
    
    
      "token" : "级",
      "start_offset" : 0,
      "end_offset" : 1,
      "type" : "q",
      "position" : 4
    },
    {
    
    
      "token" : "地震",
      "start_offset" : 0,
      "end_offset" : 2,
      "type" : "n",
      "position" : 5
    }
  ]
}

猜你喜欢

转载自blog.csdn.net/weixin_46294086/article/details/143307853