5.x以后, es对head插件的支持并不是特别好

而且kibana的功能越来越强大, 建议使用kibana

1, head插件安装

在一台机器上安装head插件就可以了

1), 更新,安装依赖

sudo yum update -y

2), 安装npm

sudo yum install npm
yum -y install git
yum -y install bz2

3), github 地址

https://github.com/mobz/elasticsearch-head

4), 安装

git clone git://github.com/mobz/elasticsearch-head.git
cd elasticsearch-head
#编译安装
npm install
#
npm run start

5) docker的安装方式:

目前只支持到5.x

docker run -p : mobz/elasticsearch-head:

6), 在es的配置文件中

http.cors.enabled: true
http.cors.allow-orgin: "*"

7) 之后重启 es 和 head插件

npm run start

8), 之后可以通过

node1:9100 进行访问

2, ik分词器插件

需要在所有机器都可以进行安装

5.x版本之后的ik分词器, 可以直接在mapping中定义了, 但也可以通过安装插件的方式实现

githuib: https://github.com/medcl/elasticsearch-analysis-ik.git

1), 几种不同的分词模式:

ik_smart :     智能分词, 粗力度

ik_max_word :  最大词语, 细力度, 占用空间

2) 安装

有2种安装方式:

  a), 直接使用es的插件下载安装

./bin/elasticsearch-plugin install https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v6.3.0/elasticsearch-analysis-ik-6.3.0.zip

  b) 手工安装

下载并解压到目录即可

plugins 目录下必须包含一层目录才可以

create plugin folder cd your-es-root/plugins/ && mkdir ik

unzip plugin to folder your-es-root/plugins/ik

3), 之后创建使用ik

create index

put index_name

create mapping

POST index_name
{
"mappings": {
{
"properties": {
"content": {
"type": "text",
"analyzer": "ik_max_word",
"search_analyzer": "ik_max_word"
}
} }
}

4) 插入数据进行查询

curl -XPOST http://localhost:9200/index/fulltext/1 -H 'Content-Type:application/json' -d'
{"content":"美国留给伊拉克的是个烂摊子吗"}
'
curl -XPOST http://localhost:9200/index/fulltext/2 -H 'Content-Type:application/json' -d'
{"content":"公安部:各地校车将享最高路权"}
'
curl -XPOST http://localhost:9200/index/fulltext/3 -H 'Content-Type:application/json' -d'
{"content":"中韩渔警冲突调查:韩警平均每天扣1艘中国渔船"}
'
curl -XPOST http://localhost:9200/index/fulltext/4 -H 'Content-Type:application/json' -d'
{"content":"中国驻洛杉矶领事馆遭亚裔男子枪击 嫌犯已自首"}
'

查询

curl -XPOST http://localhost:9200/index/fulltext/_search  -H 'Content-Type:application/json' -d'
{
"query" : { "match" : { "content" : "中国" }},
"highlight" : {
"pre_tags" : ["<tag1>", "<tag2>"],
"post_tags" : ["</tag1>", "</tag2>"],
"fields" : {
"content" : {}
}
}
}
'

5), 配置自己的字典等

{plugins}/elasticsearch-analysis-ik-*/config/IKAnalyzer.cfg.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
<properties>
<comment>IK Analyzer 扩展配置</comment>
<!--用户可以在这里配置自己的扩展字典 -->
<entry key="ext_dict">custom/mydict.dic;custom/single_word_low_freq.dic</entry>
<!--用户可以在这里配置自己的扩展停止词字典-->
<entry key="ext_stopwords">custom/ext_stopword.dic</entry>
<!--用户可以在这里配置远程扩展字典 -->
<entry key="remote_ext_dict">location</entry>
<!--用户可以在这里配置远程扩展停止词字典-->
<entry key="remote_ext_stopwords">http://xxx.com/xxx.dic</entry>
</properties>

6), 配置热更新词典

<!--用户可以在这里配置远程扩展字典 -->
<entry key="remote_ext_dict">location</entry>
<!--用户可以在这里配置远程扩展停止词字典-->
<entry key="remote_ext_stopwords">location</entry>

7), 如果分词测试失败了, 使用

curl -XGET "http://localhost:9200/_analyze?pretty&analyzer=ik_smart' -d '中华人民共和国M'

8), 不建立索引的测试ik分词器

GET _analyze?pretty
{
"analyzer": "ik_smart",
"text":"安徽省长江流域"
}

最后贴一个别人家的mapping

dynamic: true。  可以存储更多的属性, 但使用默认规则

es-07-head插件-ik分词器插件的更多相关文章

  1. IK分词器插件elasticsearch-analysis-ik 6.1.1

    http://88250.b3log.org/full-text-search-elasticsearch#b3_solo_h3_0 IK分词器插件 (1)源码 https://github.com/ ...

  2. docker上安装elasticsearch和ik分词器插件和header,实现分词功能

    docker run -di --name=tensquare_es -p 9200: -p 9300:9300 elasticsearch:5.6.8 创建elasticsearch容器(如果版本不 ...

  3. Linux下,非Docker启动Elasticsearch 6.3.0,安装ik分词器插件,以及使用Kibana测试Elasticsearch,

    Linux下,非Docker启动Elasticsearch 6.3.0 查看java版本,需要1.8版本 java -version yum -y install java 创建用户,因为elasti ...

  4. Elasticsearch 7.x - IK分词器插件(ik_smart,ik_max_word)

    一.安装IK分词器 Elasticsearch也需要安装IK分析器以实现对中文更好的分词支持. 去Github下载最新版elasticsearch-ik https://github.com/medc ...

  5. IK分词器插件

    (1)源码 https://github.com/medcl/elasticsearch-analysis-ik  (2)releases https://github.com/medcl/elast ...

  6. es的插件 ik分词器的安装和使用

    今天折腾了一天,在es 5.5.0 上安装ik.一直通过官方给定的命令没用安装成功,决定通过手工是形式进行安装.https://github.com/medcl/elasticsearch-analy ...

  7. 通过docker安装elasticsearch和安装ik分词器插件及安装kibana

    前提: 已经安装好docker运行环境: 步骤: 1.安装elasticsearch 6.2.2版本,目前最新版是7.2.0,这里之所以选择6.2.2是因为最新的SpringBoot2.1.6默认支持 ...

  8. windows elasticsearch使用ik分词器插件后启动报错java.security.AccessControlException: access denied ("java.io.FilePermission" "D:...........\plugins\ik-analyzer\config\IKAnalyzer.cfg.xml" "read")

    删除es安装文件夹中空格,遂解决......(哭

  9. Elastic Stack 笔记(二)Elasticsearch5.6 安装 IK 分词器和 Head 插件

    博客地址:http://www.moonxy.com 一.前言 Elasticsearch 作为开源搜索引擎服务器,其核心功能在于索引和搜索数据.索引是把文档写入 Elasticsearch 的过程, ...

随机推荐

  1. (概率 01背包) Just another Robbery -- LightOJ -- 1079

    http://lightoj.com/volume_showproblem.php?problem=1079 Just another Robbery As Harry Potter series i ...

  2. Alpha阶段敏捷冲刺(二)

    1.提供当天站立式会议照片一张. 2.每个人的工作 (有work item 的ID),并将其记录在码云项目管理中: 昨天已完成的工作. 祁泽文:上网了解了艾宾浩斯遗忘曲线算法. 徐璐琳:找交互模块的源 ...

  3. XA: 事务和两阶段提交

    本文原文连接:http://blog.csdn.net/bluishglc/article/details/7612811 ,转载请注明出处! 1.XA XA是由X/Open组织提出的两阶段提交协议, ...

  4. spring boot 整合 mybatis 以及原理

    同上一篇文章一样,spring boot 整合 mybatis过程中没有看见SqlSessionFactory,sqlsession(sqlsessionTemplate),就连在spring框架整合 ...

  5. javascript Object.create()究竟发生了什么

      这是我在博客园的第一篇博客,早上看了一个大牛的博客,关于javascript继承的,对于大牛使用Object.create()实现继承的方式觉得点问题,就自己研究了一下,所以就有了这篇帖子. 本帖 ...

  6. Android-Kotlin-空值处理&字符串比较&常量

    空值处理: [案例一:] 1.Kotlin对控制处理很严格,默认就不能写null,否则编译都不通过: 描述Car汽车对象: package cn.kotlin.kotlin_base01 /** * ...

  7. redis -编译、启动、停止

    一.下载.编译 redis是以源码方式发行的,先下载源码,然后在linux下编译 1.1 http://www.redis.io/download 先到这里下载Stable稳定版,目前最新版本是2.8 ...

  8. 利用gotty在web浏览器模拟终端登录

    1.随机url,9000端口访问 gotty -p " -r -w bash -i 2.简单用户名密码授权,9090端口访问 gotty -p -c user:password -w bas ...

  9. linux时间格式总结

    原文:https://blog.csdn.net/drcwr/article/details/50971637 %%   a literal %   一个文字  %a   locale's abbre ...

  10. ASP.NET Core ef启用数据迁移

    创建一个项目 通过Nuget获取EF Core相关的扩展包 appsettings.json 建立数据库连接串 创建数据库上下文EntityDbContext类,用于实体类映射数据库表 使用包管理器控 ...