Elasticsearch教程(三),IK分词器安装 (极速版)

JSON 2016-08-23 00:03:56 90593

Elasticsearch  目录

如果只想快速安装 IK  ,本教程管用。下面看经过。

简介:

  • 下面讲有我已经打包并且编辑过的zip包,你可以在下面下载即可。
  • 当前讲解的 IK分词器  包的 version 为1.8。

一、下载zip包。

    下面有附件链接【ik-安装包.zip】,下载即可。

二、上传zip包。

    下载后解压缩,如下图。

   

打开修改修改好后打成zip包。

# 'elasticsearch.version' version of elasticsearch compiled against
# You will have to release a new version of the plugin for each new
# elasticsearch release. This version is checked when the plugin
# is loaded so Elasticsearch will refuse to start in the presence of
# plugins with the incorrect elasticsearch.version.
#把这个版本号改成你对应的版本即可,如你的版本是2.2.0,就改成2.2.0
elasticsearch.version=2.0.0

/elasticsearch-2.0.0/plugins

在plugins/目录下上传,并且解压缩。此处注意目录结构必须是这样,如下图:


三、启动测试

    呃,我们发现报错了。

[elasticsearch@iZ25x3wjytdZ elasticsearch-2.0.0]$ ./bin/elasticsearch
[2016-03-01 10:32:02,958][INFO ][node                     ] [Landslide] version[2.0.0], pid[11109], build[de54438/2015-10-22T08:09:48Z]
[2016-03-01 10:32:02,959][INFO ][node                     ] [Landslide] initializing ...
Exception in thread "main" java.lang.IllegalStateException: Unable to initialize plugins
Likely root cause: java.nio.file.FileSystemException: /home/elasticsearch/es/elasticsearch-2.0.0/plugins/ik.zip/plugin-descriptor.properties: Not a directory
        at sun.nio.fs.UnixException.translateToIOException(UnixException.java:91)
        at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102)
        at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107)
        at sun.nio.fs.UnixFileSystemProvider.newByteChannel(UnixFileSystemProvider.java:214)
        at java.nio.file.Files.newByteChannel(Files.java:317)
        at java.nio.file.Files.newByteChannel(Files.java:363)
        at java.nio.file.spi.FileSystemProvider.newInputStream(FileSystemProvider.java:380)
        at java.nio.file.Files.newInputStream(Files.java:108)
        at org.elasticsearch.plugins.PluginInfo.readFromProperties(PluginInfo.java:86)
        at org.elasticsearch.plugins.PluginsService.getPluginBundles(PluginsService.java:306)
        at org.elasticsearch.plugins.PluginsService.(PluginsService.java:112)
        at org.elasticsearch.node.Node.(Node.java:144)
        at org.elasticsearch.node.NodeBuilder.build(NodeBuilder.java:145)
        at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:170)
        at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:270)
        at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:35)

一看我们就知道,他去找plugins/ik.zip 下的配置文件对吧。

解决方案是把这个ZIP包删除即可。

删除后再次启动。

[elasticsearch@iZ25x3wjytdZ elasticsearch-2.0.0]$ ./bin/elasticsearch
[2016-03-01 10:32:02,958][INFO ][node                     ] [Landslide] version[2.0.0], pid[11109], build[de54438/2015-10-22T08:09:48Z]
[2016-03-01 10:32:02,959][INFO ][node                     ] [Landslide] initializing ...
Exception in thread "main" java.lang.IllegalStateException: Unable to initialize plugins
Likely root cause: java.nio.file.FileSystemException: /home/elasticsearch/es/elasticsearch-2.0.0/plugins/ik.zip/plugin-descriptor.properties: Not a directory
        at sun.nio.fs.UnixException.translateToIOException(UnixException.java:91)
        at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102)
        at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107)
        at sun.nio.fs.UnixFileSystemProvider.newByteChannel(UnixFileSystemProvider.java:214)
        at java.nio.file.Files.newByteChannel(Files.java:317)
        at java.nio.file.Files.newByteChannel(Files.java:363)
        at java.nio.file.spi.FileSystemProvider.newInputStream(FileSystemProvider.java:380)
        at java.nio.file.Files.newInputStream(Files.java:108)
        at org.elasticsearch.plugins.PluginInfo.readFromProperties(PluginInfo.java:86)
        at org.elasticsearch.plugins.PluginsService.getPluginBundles(PluginsService.java:306)
        at org.elasticsearch.plugins.PluginsService.(PluginsService.java:112)
        at org.elasticsearch.node.Node.(Node.java:144)
        at org.elasticsearch.node.NodeBuilder.build(NodeBuilder.java:145)
        at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:170)
        at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:270)
        at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:35)

我们从启动就看的出来,IK分词器安装成功。

[2016-03-01 10:34:28,803][INFO ][plugins                  ] [Big Wheel] loaded [analysis-ik], sites [head]

测试:

http://123.57.163.79:9200/_analyze?analyzer=ik&pretty=true&text=sojson在线工具真好用
{
  "tokens" : [ {
    "token" : "sojson",
    "start_offset" : 0,
    "end_offset" : 6,
    "type" : "ENGLISH",
    "position" : 0
  }, {
    "token" : "在线",
    "start_offset" : 6,
    "end_offset" : 8,
    "type" : "CN_WORD",
    "position" : 1
  }, {
    "token" : "工具",
    "start_offset" : 8,
    "end_offset" : 10,
    "type" : "CN_WORD",
    "position" : 2
  }, {
    "token" : "真好",
    "start_offset" : 10,
    "end_offset" : 12,
    "type" : "CN_WORD",
    "position" : 3
  }, {
    "token" : "好用",
    "start_offset" : 11,
    "end_offset" : 13,
    "type" : "CN_WORD",
    "position" : 4
  } ]
}

得出Over , 有问题留言,或者找我,加群也可以。


版权所属:SO JSON在线解析

原文地址:https://www.sojson.com/blog/84.html

转载时必须以链接形式注明原始出处及本声明。


附件下载:

备注:点击文件名下载,附件源来自云端,只能在本站下载。复制下载链接无效。


如果本文对你有帮助,那么请你赞助我,让我更有激情的写下去,帮助更多的人。

关于作者
一个低调而闷骚的男人。
相关文章
Elasticsearch教程(二),IK分词器安装
Elasticsearch教程Elasticsearch Java API创建Mapping,指定分词器
Elasticsearch教程Elasticsearch 设置近义搜索,IK分词器实现同义搜索
Elasticsearch 分词Elasticsearch Java API 分词 操作
Elasticsearch教程(四) elasticsearch head 插件安装和使用
Elasticsearch教程(六) elasticsearch Client创建
Elasticsearch教程(五) elasticsearch Mapping的创建
Elasticsearch教程Elasticsearch count 查询,Elasticsearch 查询是否存在
Elasticsearch教程Elasticsearch配置文件 — elasticsearch.yml
Elasticsearch 教程Elasticsearch 日期查询详解,Elasticsearch Date 查询Java API
最新文章
PHP变量剖析 11
SQL全外连接剖析 119
SQL自然连接剖析 147
springboot启动原理 245
SQL右连接【RIGHT JOIN】详解及图解 450
SQL左链接【LEFT JOIN】详解及图解 357
SQL非等值连接剖析 262
SQL等链接剖析 291
SQL内连接详解及图解 385
python之numpy常用的100种数值相关方法及代码示例 231
最热文章
最新MyEclipse8.5注册码,有效期到2020年 (已经更新) 679241
苹果电脑Mac怎么恢复出厂系统?苹果系统怎么重装系统? 674561
免费天气API,全国天气 JSON API接口,可以获取五天的天气预报 599031
免费天气API,天气JSON API,不限次数获取十五天的天气预报 565278
Jackson 时间格式化,时间注解 @JsonFormat 用法、时差问题说明 551715
我为什么要选择RabbitMQ ,RabbitMQ简介,各种MQ选型对比 509186
Elasticsearch教程(四) elasticsearch head 插件安装和使用 479645
Jackson 美化输出JSON,优雅的输出JSON数据,格式化输出JSON数据... ... 262820
Java 信任所有SSL证书,HTTPS请求抛错,忽略证书请求完美解决 244092
Elasticsearch教程(一),全程直播(小白级别) 225127
支付扫码

所有赞助/开支都讲公开明细,用于网站维护:赞助名单查看

查看我的收藏

正在加载... ...