插件地址
https://github.com/NLPchina/elasticsearch-sql
安装步骤
下载elasticsearch-sql插件
./bin/elasticsearch-plugin install https://github.com/NLPchina/elasticsearch-sql/releases/download/5.4.0.0/elasticsearch-sql-5.4.0.0.zip
5.0以上版本还需要下载:
wget https://github.com/NLPchina/elasticsearch-sql/releases/download/5.4.1.0/es-sql-site-standalone.zip
解压:
unzip es-sql-site-standalone.zip -d es-sql-site
cd es-sql-site/site-server
npm install express --save
node node-server.js
这时就可以查询了:
http://localhost:9200/_sql?sql=select * from indexName limit 10
修改部分配置文件
- 修改访问端口号
cd es-sql-site/site-server
vim site_configuration.json
将8080,改为9400:
{
"port":9400
}
- 修改elasticsearch.yml
在安装了kibana和xpack后,在页面上查询会报以下错误:
Error:Error occured! response is not avalible.
修改elasticsearch配置文件,添加cors:
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
- 安装了xpack不想输入用户名密码
修改elasticsearch.yml,添加:
xpack.security.enabled: false