elasticSearch学习笔记
基础概念
| 关系数据库 | 表 | 行 | 列 |
| ------------ | ------------ | ------------ | ------------ | ------------ |
| Elasticsearch | 索引 |文档| 字段 |
es
docker run --rm -d --name elasticsearch --net isolated_network -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" elasticsearch:7.12.1
集群图形界面,使用chrome的head插件
进入sql的cli
docker exec -it elasticsearch /bin/bash
bin/elasticsearch-sql-cli
es三方工具
https://github.com/360EntSecGroup-Skylar/ElasticHD
kibana
准备工作
docker pull elasticsearch:7.12.1
docker run --rm -d --name kibana --net isolated_network -p 5601:5601 kibana:7.12.1
docker cp kibana:/usr/share/kibana/config/kibana.yml ~/downloads/kibana.yml
kibana.yml
i18n.locale: "zh-CN"
英文
docker run --rm -d --name kibana --net isolated_network -p 5601:5601 kibana:7.12.1
中文
docker run --rm -d --name kibana --net isolated_network -v ~/downloads/kibana.yml:/usr/share/kibana/config/kibana.yml -p 5601:5601 kibana:7.12.1
sql例子
创建索引库,demo 为 index, user 为 type, 8 以后会被弃用
PUT /demo/user/_bulk?refresh
{"index":{"_id": "1111111"}}
{"name": "name1", "author": "author1", "release_date": "2011-06-02", "page_count": 1}
{"index":{"_id": "2222222"}}
{"name": "name2", "author": "author2", "release_date": "1989-05-26", "page_count": 2}
{"index":{"_id": "3333333"}}
{"name": "name3", "author": "author3", "release_date": "1965-06-01", "page_count": 3}
查询
POST /_sql?format=txt
{
"query": "select * from demo"
}