參考來自:java
http://blog.csdn.net/u012307002/article/details/52837756python
https://github.com/NLPchina/elasticsearch-sqlgit
es的查詢雖然功能很強大,可是查詢語言(DSL)很麻煩,無論是封裝json仍是經過python/java的api進行封裝,都不方便。而elasticsearch-SQL能夠用sql查詢es,對於不熟悉es的DSL的人來講,更爲簡便和易讀。github
Elasticsearch-sql支持的功能:sql
(1)插件式的安裝json
(2)SQL查詢api
(3)超越SQL以外的查詢elasticsearch
(4)對JDBC方式的支持url
官方安裝指導:https://github.com/NLPchina/elasticsearch-sqlspa
step1:執行安裝命令
選擇與es匹配的版本,在bin目錄下執行命令:
1 plugin install https://github.com/NLPchina/elasticsearch-sql/releases/download/2.4.2.1/elasticsearch-sql-2.4.2.1.zip
step1:下載es-sql的zip包
選擇與es匹配的版本進行下載,https://github.com/NLPchina/elasticsearch-sql/releases/download/
step2:將其解壓,放至es的plugins文件夾下,並改名爲sql
step3:重啓es
若是es安裝成功,訪問路徑 http://localhost:9200/_plugin/sql/ ,應出現以下畫面:
url:http://127.0.0.1:9200/song001/list001/1 POST
data:{"number":32768,"singer":"楊坤","size":"5109132","song":"今夜二十歲","tag":"中國好聲音","timelen":319}
(1)在es-sql的可視化頁面中使用sql進行查詢
(2)經過發起http請求使用sql進行查詢
或者
返回的是json格式的數據:(斷網了,只好用之前的圖了)
https://github.com/NLPchina/elasticsearch-sql
除了支持sql本來的語法以外,還有beyond sql: