es7.9.3安装kibana同义词ik分词器拼音
一、es安装
1.1、配置
config/elasticsearch.yml
# 打开节点名称
node.name: chb2
# 这里的node-1为node-name配置的值
cluster.initial_master_nodes:["chb2"]
# 外部ip访问elasticsearch
network.host: 0.0.0.0
1.2、Ps:常见报错
[1]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
elasticsearch用户拥有的内存权限太小,至少需要262144;
//需要切换到root用户
sysctl -w vm.max_map_count=262144
//查看结果
sysctl -a|grep vm.max_map_count
//显示
vm.max_map_count = 262144
//修改之后,如果重启虚拟机将失效!!!
//解决办法:
//在 /etc/sysctl.conf文件最后添加一行
vm.max_map_count=262144
[2]: the default discovery settings are unsuitable for production use; at least one of [discovery.seed_hosts, discovery.seed_providers, cluster.initial_master_nodes] must be configured
修改ES配置文件:config/elasticsearch.yml
//解开注释
cluster.initial_master_nodes: ["node-1", "node-2"]
二、kibana安装
vim kibana.yml
server.port: 5601server.host: "0.0.0.0"elasticsearch.hosts: ["http://192.168.200.110:9200"]
2.2、问题
2.2.1、Error: Could not close browser client handle!
在kibana的config中的kibana.yml中配置
elasticsearch.hosts: [“http://192.168.147.52:9200”]
xpack.reporting.capture.browser.chromium.disableSandbox: true
xpack.reporting.capture.browser.chromium.proxy.enabled: false
xpack.reporting.enabled: false
详细请参考:
https://www.elastic.co/guide/en/kibana/current/settings.html kibana官方配置
https://www.cnblogs.com/sanduzxcvbnm/p/12677691.html
https://www.ucloud.cn/yun/34216.html
三、ik分词器
3.1、ik配置
1、下载ik分词器 https://github.com/medcl/elasticsearch-analysis-ik/releases/tag/v7.9.3
2、解压到es的plugins目录下
3、重启es
3.2、配置自定义词库
1、配置自定义词库文件
对于部分专业词语,我们不想进行分词,所以ik分词器提供自定义词库
修改plugins/ik/config/IKAnalyzer.cfg.xml,可以使用本地自定义词库,也可以使用远程分词库(建议使用远程,这样不用每次重启es集群)
<properties><comment>IK Analyzer 扩展配置comment><entry key="ext_dict">custom.dicentry><entry key="ext_stopwords">entry>
properties>

3、重启es
配置自定义词库前

配置自定义词库后

四、同义词
4.1、配置
1、配置同义词词库

2、重启
3、创建索引,设置settings
PUT test1
{"settings": {"number_of_shards": 1,"number_of_replicas": 1,"analysis": {"filter": {"word_sync": {"type": "synonym","synonyms_path": "analysis/synonym.txt"}},"analyzer": {"ik_sync_smart": {"filter": ["word_sync"],"type": "custom","tokenizer": "ik_smart"}}}},"mappings": {"properties": {"name": {"type": "text","fields": {"synoword": {"type": "text","analyzer": "ik_sync_smart"}}}}}
}

五、拼音
5.1、配置pinyin插件
1、下载plugin https://github.com/medcl/elasticsearch-analysis-pinyin/releases/tag/v7.9.3
2、解压刀plugins目录下的pinyin目录
3、重启es
5.4、测试拼音

六、综合
1、创建index
PUT test1
{"settings": {"number_of_shards": 1,"number_of_replicas": 1,"analysis": {"filter": {"word_sync": {"type": "synonym","synonyms_path": "analysis/synonym.txt"}},"analyzer": {"ik_sync_smart": {"filter": ["word_sync"],"type": "custom","tokenizer": "ik_smart"},"pinyin_analyzer": {"type": "custom","tokenizer": "pinyin_tokenizer"}},"tokenizer": {"pinyin_tokenizer": {"type": "pinyin"}}}},"mappings": {"properties": {"name": {"type": "text","fields": {"synoword": {"type": "text","analyzer": "ik_sync_smart"},"pinyin": {"type": "text","analyzer": "pinyin_analyzer"}}}}}
}
2、添加数据
PUT test1/_doc/1
{"name": "全季"
}
PUT test1/_doc/2
{"name": "拳击馆"
}PUT test1/_doc/3
{"name": "汉庭"
}
3、查询

本文来自互联网用户投稿,文章观点仅代表作者本人,不代表本站立场,不承担相关法律责任。如若转载,请注明出处。 如若内容造成侵权/违法违规/事实不符,请点击【内容举报】进行投诉反馈!
