【一键安装】一键安装elasticsearch和ik分词

在命令行创建install.sh脚本,并将以下内容贴进去:

#!/bin/bash
# 高升前端代码发布脚本
set -e
export LANG=zh_CN.UTF-8

#下载es7.15.1版本
wget https://mirrors.huaweicloud.com/elasticsearch/7.15.1/elasticsearch-7.15.1-x86_64.rpm

#下载es7.17.7版本
#wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.17.7-x86_64.rpm

#安装Es
#rpm --install elasticsearch-7.17.7-x86_64.rpm
rpm --install elasticsearch-7.15.1-x86_64.rpm

#进度插件目录
cd  /usr/share/elasticsearch/plugins

#创建插件目录
mkdir es_ik
cd es_ik

#下载Ik分词插件
#wget https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v7.17.7/elasticsearch-analysis-ik-7.17.7.zip
wget https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v7.15.1/elasticsearch-analysis-ik-7.15.1.zip
#解压插件
#unzip elasticsearch-analysis-ik-7.17.7.zip
unzip elasticsearch-analysis-ik-7.15.1.zip

#重新启动ES
systemctl restart elasticsearch.service

#测试分词
curl -XPOST "localhost:9200/_analyze" -H 'Content-Type: application/json' -d'
{
  "analyzer": "ik_smart",
  "text": "中国和韩国"
}'

在命令行执行安装:

bash install.sh

然后会看到如下测试输出,则表示es和ik分词都已经安装完毕:

{"tokens":[{"token":"中国","start_offset":0,"end_offset":2,"type":"CN_WORD","position":0},{"token":"和","start_offset":2,"end_offset":3,"type":"CN_CHAR","position":1},{"token":"韩国","start_offset":3,"end_offset":5,"type":"CN_WORD","position":2}]}

附录:

华为ES镜像地址:Index of elasticsearch-local

IK分词组件版本下载地址:https://github.com/medcl/elasticsearch-analysis-ik/releases

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值