溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點(diǎn)擊 登錄注冊 即表示同意《億速云用戶服務(wù)條款》

IK分詞器安裝

發(fā)布時(shí)間:2020-06-30 23:54:11 來源:網(wǎng)絡(luò) 閱讀:610 作者:yushiwh 欄目:系統(tǒng)運(yùn)維

簡介:

  • 當(dāng)前講解的 IK分詞器  包的 version 為1.8。

一、下載zip包。

    下面有附件鏈接【ik-安裝包.zip】,下載即可。

二、上傳zip包。

    下載后解壓縮,如下圖。

    IK分詞器安裝cdn.sojson.com/file/16-03-01-02-26-18/doc/7386405912">

打開修改修改好后打成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.#把這個(gè)版本號改成你對應(yīng)的版本即可,如你的版本是2.2.0,就改成2.2.0elasticsearch.version=2.0.0

/elasticsearch-2.0.0/plugins

在plugins/目錄下上傳,并且解壓縮。此處注意目錄結(jié)構(gòu)必須是這樣,如下圖:

IK分詞器安裝


三、啟動(dòng)測試

    呃,我們發(fā)現(xiàn)報(bào)錯(cuò)了。

[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 pluginsLikely 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 下的配置文件對吧。

解決方案是把這個(gè)ZIP包刪除即可。

刪除后再次啟動(dòng)。

[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 pluginsLikely 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)

我們從啟動(dòng)就看的出來,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 。

分詞器下載地址:http://down.51cto.com/data/2323000

向AI問一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI