Windows下安装Elasticsearch6.4.1和Head,IK分词器

所需运行环境

1、安装jdk1.8(步骤略)

2、安装git(步骤略)
3、安装nodejs(步骤略)

一、ElasticSearch的安装

下载elasticsearch6.4.1,将下载后的es解压,进入bin文件夹,执行elasticsearch.bat,正常情况es发布在9200端口,访问http://localhost:9200

二、安装ElasticSearch-Head

下载es-head。git clone git://github.com/mobz/elasticsearch-head.git

解压后进入elasticsearch-head文件夹,执行npm install

成功后执行 npm run start,正常情况将在9100端口运行,可通过http://localhost:9100 访问。
默认情况es只能在本机访问,为调试方便,修改es目录下config文件夹下,elasticsearch.yml文件,将network.host前的注释放开,并将192.168.0.1改为0.0.0.0,重启elasticsearch.bat。
使用head连接es时可能会报跨域问题,修改es目录下config文件夹下,elasticsearch.yml文件,在最后追加下面两行代码后重启elasticsearch.bat。
http.cors.enabled: true
http.cors.allow-origin: “*”

三、安装IK分词器

下载IK插件 

进入elasticsearch目录,将ik分词插件解压进去,然后再启动 elasticsearch.bat

运行看到IK标志就是运行成功了

使用postman测试IK分词

IK分词效果有两种,一种是ik_max_word(最大分词)和ik_smart(最小分词)

原文地址:https://www.cnblogs.com/langhaoabcd/p/10268101.html