Elasticsearch简介
一个高效的存储搜索分析引擎,集成封装了lucene(apache 的存储功能)
索引
动词:index 插入
名词 :数据库
文档
类型
实现原理
Elasticsearch在创建数据库的时候就讲内容进行分词,
下载 安装
安装es及挂载文件
docker pull elasticsearch:7.4.2
docker pull kibana:7.4.2
mkdir -p /opt/mydata/elasticsearch/config
创建一个elasticsearch.yml文件
mkdir -p /opt/mydata/elasticsearch/data
docker run --name elasticsearch -p 9200:9200 -p 9300:9300 -e “discovery.type=single-node” -e ES_JAVA_OPTS="-Xms128m -Xmx256m" -v /opt/mydata/elasticsearch/config/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml -v /opt/mydata/elasticsearch/data:/usr/share/elasticsearch/data -v /opt/mydata/elasticsearch/plugins:/usr/share/elasticsearch/plugins -d elasticsearch:7.4.2
如果启动失败
设置文件夹权限
chmod -R 777 /opt/mydata/elasticsearch
http://116.62.138.50:9200/
安装可视化界面
docker run --name kibana -e ELASTICSEARCH_HOSTS=http://127.0.0.1:9200 -p 5601:5601 -d kibana:7.4.2
命令 rest api
_cat
http://116.62.138.50:9200/_cat/node
http://116.62.138.50:9200/_cat/health
http://116.62.138.50:9200/_cat/master
http://116.62.138.50:9200/_cat/indlces show datebases
索引一个文档
http://116.62.138.50:9200/customer/external/1
host/索引/type/id
put 和post有点小区别 就是带不带id
http://116.62.138.50:9200/customer/external/1?if_seq_no=4&&if_primary_term=1
post修改请求防并发