es7.9.3安装&kibana&同义词&ik分词器&拼音
Posted 宝哥大数据
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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: 5601
server.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集群)
<?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.dic</entry>
<!--用户可以在这里配置自己的扩展停止词字典-->
<entry key="ext_stopwords"></entry>
<!--用户可以在这里配置远程扩展字典 -->
<!-- <entry key="remote_ext_dict">words_location</entry> -->
<!--用户可以在这里配置远程扩展停止词字典-->
<!-- <entry key="remote_ext_stopwords">words_location</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、查询
以上是关于es7.9.3安装&kibana&同义词&ik分词器&拼音的主要内容,如果未能解决你的问题,请参考以下文章
最简化 Elasticsearch & Kibana & Filebeat 安装说明
Helm 安装 ElasticSearch & Kibana 日志平台
elastic search&logstash&kibana 学习历程Logstash使用场景和安装部署