暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

elastic-search sql 支持sql查询es里的数据--部署调试通过记录

原创 途er 2023-02-13
776

1.https://github.com/NLPchina/elasticsearch-sql/releases/download/7.6.0.0/elasticsearch-sql-7.6.0.0.zip   下载

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会报错)也可以去修改它的限制这里可以找度娘

 

最后修改时间:2023-02-14 00:04:47
「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论