前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >Elasticsearch-SQL

Elasticsearch-SQL

作者头像
用户2936994
发布2018-08-27 10:51:48
3250
发布2018-08-27 10:51:48
举报
文章被收录于专栏:祝威廉

Elasticsearch-SQL

Elasticsearch-SQL fork from https://github.com/NLPchina/elasticsearch-sql

visit interactive web to feel.

features

All features following require ES with groovy script enabled.

  • Distinct precision_threshold depends on ES or you can specify by second parameters. When you have lot of shards, 40000 consume too much memory.
  • select,groupBy now support functions and field alias
  • nested function is also available,eg. split(substring('newtype',0,3),'c')[0]
  • Binary operation support now, eg. floor(substring(newtype,0,14)/100)/5)*5

functions support

  • floor
  • split
  • trim
  • log
  • log10
  • substring
  • round
  • sqrt
  • concat_ws
  • /
  • %

Example

check Example file:

代码语言:javascript
复制
org.nlpcn.es4sql.Test

SQLs:

代码语言:javascript
复制
SELECT newtype as nt  from  twitter2 

SELECT sum(num) as num2,newtype as nt  
from  twitter2 
group by nt  order by num2 

SELECT sum(num_d) as num2,split(newtype,',') as nt  
from  twitter2 
group by nt  
order by num2

SELECT sum(num_d) as num2,floor(num) as nt  
from  twitter2 
group by floor(num),newtype  
order by num2

SELECT split('newtype','b')[1] as nt,sum(num_d) as num2   
from  twitter2 
group by nt

SELECT split(substring('newtype',0,3),'c')[0] as nt,num_d   
from  twitter2 
group by nt

SELECT trim(newtype) as nt 
from  twitter2


SELECT floor(floor(substring(time,0,14)/100)/5)*5 as nt,
count(distinct(mid)) as cvalue 
FROM twitter2  
where ty='buffer' and day='20160815' and domain='baidu.com' 
group by nt 
order by cvalue 
本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2016.08.19 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • Elasticsearch-SQL
  • features
  • functions support
  • Example
相关产品与服务
Elasticsearch Service
腾讯云 Elasticsearch Service(ES)是云端全托管海量数据检索分析服务,拥有高性能自研内核,集成X-Pack。ES 支持通过自治索引、存算分离、集群巡检等特性轻松管理集群,也支持免运维、自动弹性、按需使用的 Serverless 模式。使用 ES 您可以高效构建信息检索、日志分析、运维监控等服务,它独特的向量检索还可助您构建基于语义、图像的AI深度应用。
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档