2.docker-compose.yml里 映射路径 volumes: - /home:/home 把elasticsearch-sql-7.6.0.0.zip从 centos主机挂载到docker
3. 安装plugins [root@d99c763daaa0 elasticsearch]# /usr/share/elasticsearch/bin/elasticsearch-plugin install file:/home/elasticsearch-sql-7.6.0.0.zip
4.elasticsearch-plugin list看有没有安装成功
5.重启docker ,用docker-compose restart
6.在grome里安装插件,https://github.com/shi-yuan/elasticsearch-sql-site-chrome/releases 下载https://github.com/shi-yuan/elasticsearch-sql-site-chrome/archive/refs/tags/2.0.zip
7.安装后显示Elasticsearch-Sql-Site 5.0.0,就可以使用了,在chrome使用该插件 chrome-extension://affmefhpcliccblemgcjmbmnpdggmcfk/elasticsearch-sql-site/index.html
8.sql窗口输入查询语句,显示数据正常。
所有相关资料如下:
链接:https://pan.baidu.com/s/1khcJMWmqP0ZwbstHigVmwQ
提取码:6666
加v: jacky666ok
PUT /test2/_doc/2
{
"name":"wang",
"age":23,
"brithday":"2000-01-01",
"married":"false"
}
安装elasticsearch-sql插件
1.获取es容器id
docker ps复制
2.进入es容器
docker exec -it 容器id /bin/bash复制
3.安装 es 对应版本的 es-sql
es-sql github地址:https://github.com/NLPchina/elasticsearch-sql
./bin/elasticsearch-plugin install https://github.com/NLPchina/elasticsearch-sql/releases/download/7.6.2.0/elasticsearch-sql-7.6.2.0.zip复制
4.退出容器
exit复制
5.重启docker容器
docker restart 容器ID复制
6.通过sql 查询
curl -X GET "ip:9200/_nlpcn/sql" -H 'Content-Type: application/json' -d'select * from 表 limit 10'复制
7.web可视化界面
下载插件跟es-head一样。
进入es容器添加 /usr/share/elasticsearch/config elasticsearch.yml
http.cors.enabled: true http.cors.allow-credentials: true http.cors.allow-origin : "*" http.cors.allow-headers: WWW-Authenticate,X-Requested-With,X-Auth-Token,Content-Type,Content-Length,Authorization复制
es-sql 分页默认最大10000条 (也就是说limit 10000,10100会报错)也可以去修改它的限制这里可以找度娘