elasticsearch-sql插件的使用

elasticsearch-sql插件使用

1、2,elasticsearch-sql安装:

第一安装:当前的es版本如果是6.8.10,你要去下载es的sql插件版本也是6.8.10

2.根据es版本下载相应的es-sql
https://github.com/NLPchina/elasticsearch-sql
3.1离线安装

在es的插件目录下新建文件夹sql,将解压的文件夹中的文件复制到sql中;

3,es-sql-site-standalone安装

管理后台:

Then
start the web front-end like this:

cd site-server

npm install express --save

node node-server.js

3.修改elasticsearch配置文件,增加下面参数配置  【看样子应该是允许跨域访问的配置,因为下面的elasticsearch-sql web界面安装需要跨域访问】

vim /data/elasticsearch/config/elasticsearch.yml 

 

3.修改elasticsearch配置文件,增加下面参数配置  【看样子应该是允许跨域访问的配置,因为下面的elasticsearch-sql web界面安装需要跨域访问】

vim /data/elasticsearch/config/elasticsearch.yml

访问:http://localhost:8082站点成功(手动修改site_configuration.json中默认端口)

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

7.安装nodejs

linux版本有专门的node js版本

1、下载地址:http://nodejs.cn/download/

1、查看sql插件github

https://github.com/NLPchina/elasticsearch-sql

2、安装

1、cd elasticsearch  #进入目录

2、./bin/elasticsearch-plugin install https://github.com/NLPchina/elasticsearch-sql/releases/download/5.4.3.0/elasticsearch-sql-5.4.3.0.zip

3、下载SQL的Server

wget https://github.com/NLPchina/elasticsearch-sql/releases/download/5.4.1.0/es-sql-site-standalone.zip

4、解压编译安装

unzip es-sql-site-standalone.zip
cd site-server/
npm install express --save

5、修改启动端口,然后启动server

1、修改SQL的Server的端口
  vi site_configuration.json
2、启动服务
  node node-server.js &


启动之后我们就可以进行es的管理后台页面了

 现在我们来验证下整个sql插件的功能,我们先使用kibana,创建一个索引数据

 我们来查询的时候,我们如何使用这个插件了

 只显示需要的字段

 使用where参数

原文地址:https://www.cnblogs.com/kebibuluan/p/13820540.html