File tree Expand file tree Collapse file tree 1 file changed +128
-0
lines changed
Expand file tree Collapse file tree 1 file changed +128
-0
lines changed Original file line number Diff line number Diff line change @@ -137,6 +137,134 @@ elasticsearch hard memlock unlimited
137137 - Bigdesk:`/usr/program/elk/elasticsearch-2.4.1/bin/plugin install hlstudio/bigdesk`
138138 - 安装完的访问地址:`http://192.168.1.127:9200/_plugin/bigdesk`
139139 - 卸载:`/usr/share/elasticsearch/bin/elasticsearch-plugin remove 插件名称`
140+ - IK 分词插件的安装
141+ - IK 分词官网:<https://github.com/medcl/elasticsearch-analysis-ik>
142+ - 官网首页已经有一个表格说明 ES 版本和 IK 插件的版本对应,我们可以看到:ES 2.4.1 对应 IK 分词 1.10.1,下载地址:<https://github.com/medcl/elasticsearch-analysis-ik/releases/tag/v1.10.1>
143+ - 进入 ES 插件目录:`cd /usr/program/elk/elasticsearch-2.4.1/plugins`
144+ - 创建 ik 目录:`mkdir ik`
145+ - 把下载的 elasticsearch-analysis-ik-1.10.1.zip 上传到刚新建的 ik 目录下
146+ - 解压:`unzip elasticsearch-analysis-ik-1.10.1.zip`
147+ - 删除压缩包:`rm -rf elasticsearch-analysis-ik-1.10.1.zip`
148+ - 编辑 ES 配置文件:`vim /usr/program/elk/elasticsearch-2.4.1/config/elasticsearch.yml`
149+ - 在文件底部添加如下内容:
150+
151+ ``` ini
152+ index.analysis.analyzer.default.tokenizer : " ik_max_word"
153+ index.analysis.analyzer.default.type: " ik"
154+ ```
155+
156+ - 重启 ES : /usr/program/elk/elasticsearch-2.4.1/bin/elasticsearch
157+ - 验证 ik 插件:浏览器访问:`http://192.168.1.127:9200/_analyze?analyzer=ik&pretty=true&text=这是一个针对程序员优化的导航GitNavi.com`,能得到如下结果就表示成功:
158+
159+ ``` json
160+ [
161+ {
162+ "token" : " 这是" ,
163+ "start_offset" : 0 ,
164+ "end_offset" : 2 ,
165+ "type" : " CN_WORD" ,
166+ "position" : 0
167+ },
168+ {
169+ "token" : " 一个" ,
170+ "start_offset" : 2 ,
171+ "end_offset" : 4 ,
172+ "type" : " CN_WORD" ,
173+ "position" : 1
174+ },
175+ {
176+ "token" : " 一" ,
177+ "start_offset" : 2 ,
178+ "end_offset" : 3 ,
179+ "type" : " TYPE_CNUM" ,
180+ "position" : 2
181+ },
182+ {
183+ "token" : " 个" ,
184+ "start_offset" : 3 ,
185+ "end_offset" : 4 ,
186+ "type" : " COUNT" ,
187+ "position" : 3
188+ },
189+ {
190+ "token" : " 针对" ,
191+ "start_offset" : 4 ,
192+ "end_offset" : 6 ,
193+ "type" : " CN_WORD" ,
194+ "position" : 4
195+ },
196+ {
197+ "token" : " 程序员" ,
198+ "start_offset" : 6 ,
199+ "end_offset" : 9 ,
200+ "type" : " CN_WORD" ,
201+ "position" : 5
202+ },
203+ {
204+ "token" : " 程序" ,
205+ "start_offset" : 6 ,
206+ "end_offset" : 8 ,
207+ "type" : " CN_WORD" ,
208+ "position" : 6
209+ },
210+ {
211+ "token" : " 序" ,
212+ "start_offset" : 7 ,
213+ "end_offset" : 8 ,
214+ "type" : " CN_WORD" ,
215+ "position" : 7
216+ },
217+ {
218+ "token" : " 员" ,
219+ "start_offset" : 8 ,
220+ "end_offset" : 9 ,
221+ "type" : " CN_CHAR" ,
222+ "position" : 8
223+ },
224+ {
225+ "token" : " 优化" ,
226+ "start_offset" : 9 ,
227+ "end_offset" : 11 ,
228+ "type" : " CN_WORD" ,
229+ "position" : 9
230+ },
231+ {
232+ "token" : " 导航" ,
233+ "start_offset" : 12 ,
234+ "end_offset" : 14 ,
235+ "type" : " CN_WORD" ,
236+ "position" : 10
237+ },
238+ {
239+ "token" : " 航" ,
240+ "start_offset" : 13 ,
241+ "end_offset" : 14 ,
242+ "type" : " CN_WORD" ,
243+ "position" : 11
244+ },
245+ {
246+ "token" : " gitnavi.com" ,
247+ "start_offset" : 14 ,
248+ "end_offset" : 25 ,
249+ "type" : " LETTER" ,
250+ "position" : 12
251+ },
252+ {
253+ "token" : " gitnavi" ,
254+ "start_offset" : 14 ,
255+ "end_offset" : 21 ,
256+ "type" : " ENGLISH" ,
257+ "position" : 13
258+ },
259+ {
260+ "token" : " com" ,
261+ "start_offset" : 22 ,
262+ "end_offset" : 25 ,
263+ "type" : " ENGLISH" ,
264+ "position" : 14
265+ }
266+ ]
267+ ```
140268
141269### 构建 elasticsearch 集群
142270
You can’t perform that action at this time.
0 commit comments