前置
elasticsearch版本:7.0.0
安装elasticsearch-sql插件
安装命令:./bin/elasticsearch-plugin install https://github.com/NLPchina/elasticsearch-sql/releases/download/7.0.0.0/elasticsearch-sql-7.0.0.0.zip
执行测试:
curl -X GET "XXXXX:9200/_sql" -H 'Content-Type: application/json' -d'select * from tspark limit 10'
得到如下结果:{"took":146,"timed_out":false,"_shards":XXXXX}
安装过程可能出现错误信息:
uncaught exception in thread [main]
org.elasticsearch.bootstrap.StartupException: java.lang.IllegalArgumentException: Cannot replace existing handler for [/_sql] for method: POST
原因:elasticsearch-sql与自带的x-pack-sql模块冲突,vi /opt/elasticsearch/config/elasticsearch.yml 修改
xpack.sql.enabled: false重启ES,参考链接
网友评论