es查询新姿势

es6.3版本后内置了_xpack,可支持sql的查询

POST _xpack/sql?format=txt
{
  "query":"select sum(cnts) from ads_iot_electricity_index where dt='2020-09-16' and projectIdentify ='120100LAE'"
}

POST _xpack/sql?format=txt
{
  "query":"select * from ads_iot_latest_index where meterKind=0 order by projectIdentify,equipmentNo,meterVarId,type,name"
}


POST _xpack/sql?format=txt
{
  "query":"select * from ads_iot_latest_index where meterKind=3"
}

POST _xpack/sql?format=txt
{
  "query":"select * from ads_iot_latest_index where meterKind=1"
}

POST _xpack/sql?format=txt
{
  "query":"select * from ads_iot_latest_index where meterKind=4"
}

POST _xpack/sql?format=txt
{
  "query":"select * from ads_iot_latest_index where meterKind=6"
}

 

你可能感兴趣的:(大数据,es,sql)