天天看點

elasticsearch-HQ 安裝與使用

https://github.com/ElasticHQ/elasticsearch-HQ

  1. Download or clone the repository.
  2. Open terminal and point to root of repository. Type:

    pip install -r requirements.txt

  3. Run server with: 
    nohup /usr/bin/python3 -u /usr/local/software/elasticsearch-HQ-master/application.py >>all.log 2>&1 &      
  4. Access HQ with:

    http://localhost:5000

  安裝elasticsearch-sql-6.2.2

cd /usr/local/elasticsearch

./bin/elasticsearch-plugin install https://github.com/NLPchina/elasticsearch-sql/releases/download/6.2.2.0/elasticsearch-sql-6.2.2.0.zip      
cd site-server
npm install express --save

      
nohup node node-server.js >>node-server.log 2>&1 &      
可以在site-server/site_configuration.json配置檔案中修改啟動服務的端口。


4.重新開機es,再啟動es-sql前端

     添加es-sql插件後,重新開機es,然後啟動es-sql前端服務

     啟動前端服務:先切換到es-sql/site-server目錄下,執行如下語句
node node-server.js &


     啟動後,通路:http://ip:8088/   然後配置es位址,如下:

      
  • Simple query
http://data.xxxx.com:9200/_sql?sql=select * from t_base_student limit 10      
SELECT identity_id,person_id,sum(resource_size_int) as sumall FROM t_resource_info group by identity_id,person_id order by sumall desc limit 100      
  • Explain SQL to elasticsearch query DSL
http://localhost:9200/_sql/_explain?sql=select * from indexName limit 10