elasticsearch-sql安装和使用

1.elasticsearch-sql在线安装

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

2.elasticsearch-sql离线安装

$./elasticsearch-plugin install file:/home/bdp/shangeshishi/elasticsearch-6.5.4/elasticsearch-sql-6.5.4.0.zip 

3.elasticsearch-sql的postMan请求

请求地址


http://10.45.47.66:9200/_sql
注:es7的为:

http://10.45.47.66:9200/_nlpcn/sql

请求头
Content-Type:application/json
Authorization:Basic ZWxhc3RpYzpiZHAxMjM=
请求参数
{
"sql":"desc label_user_info_base_es_20190729"
}
请求效果

低于6.5版本的查询方式略有不同,查询方式为:
http://10.45.47.66:9200/_sql?sql=select * from label_user_info_base_es_20190729

附Base64加密获取代码示例:
String authString = userName + ":" + password;
byte[] authEncBytes = Base64.encodeBase64(authString.getBytes("utf-8"));
String authStringEnc =new String(authEncBytes);

相关pom依赖
<dependency>
    <groupId>commons-codec</groupId>
    <artifactId>commons-codec</artifactId>
    <version>1.14</version>
</dependency>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值