安裝支持elasticsearch使用sql查詢插件

1、ElasticSearch-SQL介紹前端

ElasticSearch-SQL(後續簡稱es-sql)是ElasticSearch的一個插件,提供了es 的類sql查詢的相關接口。支持絕大多數的sql查詢支持。node

ElasticSearch-sql 地址:https://github.com/NLPchina/elasticsearch-sql  

git

2、ElasticSearch-SQL安裝github

1.環境介紹:sql

ElasticSearch-sql:5.5.2.0express

Elasticsearch:5.6.10版本npm

操做系統:Centos 6.8cors

JDK: 1.8elasticsearch

機器要通外網***spa


2..安裝es-sql依賴node npm

es-sql 5.x版本之後,安裝須要依賴node 和 npm ,先安裝node和npm,安裝後在檢查node及npm的安裝,命令以下:

yum -y install nodejs npm
node -v 
npm -v

3.下載es-sql並安裝

而後切換到es的根目錄下,執行以下命令,下載並安裝es-sql插件:

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

4.安裝配置es-sql的前端 

在es 5.X後,須要下載 es-sql的extract site ,並解壓,下載地址以下:https://github.com/NLPchina/elasticsearch-sql/releases/download/5.4.1.0/es-sql-site-standalone.zip

(須要FQ下載),而後切換到解壓文件目錄中的site-server中。執行以下安裝命令:

cd site-server
npm config set registry http://registry.npm.taobao.org/ (使用更快的源) npm install express
--save

端口默認是8088,能夠更改成其餘端口,好比說8092,避免衝突

5.要更改es的一個參數,不然查詢數據會報錯,編輯elasticsearch.yml:

http.cors.enabled: true
http.cors.allow-origin: "*"

6.重啓es,再啓動es-sql前端;
   添加es-sql插件後,重啓es,而後啓動es-sql前端服務;
   啓動前端服務:先切換到es-sql/site-server目錄下,執行以下語句

node node-server.js &

7.查看效果:

 

相關文章
相關標籤/搜索