Elasticsearch-SQL

本文涉及的产品
检索分析服务 Elasticsearch 版,2核4GB开发者规格 1个月
简介: Elasticsearch-SQL 语句

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:
org.nlpcn.es4sql.Test
SQLs:
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
相关实践学习
使用阿里云Elasticsearch体验信息检索加速
通过创建登录阿里云Elasticsearch集群,使用DataWorks将MySQL数据同步至Elasticsearch,体验多条件检索效果,简单展示数据同步和信息检索加速的过程和操作。
ElasticSearch 入门精讲
ElasticSearch是一个开源的、基于Lucene的、分布式、高扩展、高实时的搜索与数据分析引擎。根据DB-Engines的排名显示,Elasticsearch是最受欢迎的企业搜索引擎,其次是Apache Solr(也是基于Lucene)。 ElasticSearch的实现原理主要分为以下几个步骤: 用户将数据提交到Elastic Search 数据库中 通过分词控制器去将对应的语句分词,将其权重和分词结果一并存入数据 当用户搜索数据时候,再根据权重将结果排名、打分 将返回结果呈现给用户 Elasticsearch可以用于搜索各种文档。它提供可扩展的搜索,具有接近实时的搜索,并支持多租户。
目录
相关文章
|
4月前
|
SQL 关系型数据库 MySQL
使用Flink CDC从SQL Server同步数据到MySQL
使用Flink CDC从SQL Server同步数据到MySQL
141 1
|
SQL 分布式计算 资源调度
使用flink SQL Client将mysql数据写入到hudi并同步到hive
本文介绍如何使用flink SQL Client将mysql数据写入到hudi并同步到hive
使用flink SQL Client将mysql数据写入到hudi并同步到hive
|
4月前
|
SQL Scala
Elasticsearch-SQL介绍
Elasticsearch-SQL介绍
34 1
|
3月前
|
存储 SQL NoSQL
第3期 MongoDB与SQL存储
第3期 MongoDB与SQL存储
57 0
|
关系型数据库 MySQL Go
使用go-mysql-elasticsearch同步mysql数据库信息到ElasticSearch
本文介绍如何使用go-mysql-elasticsearch同步mysql数据库信息到ElasticSearch。1.go-mysql-elasticsearch简介go-mysql-elasticsearch是一个将MySQL数据自动同步到Elasticsearch的服务。
4162 0
|
11月前
|
存储 SQL 分布式计算
「PostgreSQL」用MapReduce的方式思考,但使用SQL
「PostgreSQL」用MapReduce的方式思考,但使用SQL
|
11月前
|
SQL 弹性计算 Kubernetes
实践教程之采集PolarDB-X SQL日志到ElasticSearch
PolarDB-X 为了方便用户体验,提供了免费的实验环境,您可以在实验环境里体验 PolarDB-X 的安装部署和各种内核特性。除了免费的实验,PolarDB-X 也提供免费的视频课程,手把手教你玩转 PolarDB-X 分布式数据库。本期实验将指导您如何采集PolarDB-X SQL日志到ElasticSearch。
|
SQL 存储 缓存
【最佳实践】使用 Elasticsearch SQL 实现数据查询
如何使用 Elasticsearch SQL 来对我们的数据进行查询。
4762 0
【最佳实践】使用 Elasticsearch SQL 实现数据查询
|
SQL Java 数据库连接
玩转 Elasticsearch 的 SQL 功能
  最近发布的 Elasticsearch 6.3 包含了大家期待已久的 SQL 特性,今天给大家介绍一下具体的使用方法。   首先看看接口的支持情况   目前支持的 SQL 只能进行数据的查询只读操作,不能进行数据的修改,所以我们的数据插入还是要走之前的常规索引接口。
414 0
|
数据可视化 关系型数据库 MySQL
go-mysql-elasticsearch实现mysql 与elasticsearch实时同步深入详解
引言: go-mysql-elasticsearch 是国内作者开发的一款插件。测试表明:该插件优点:能实现同步增、删、改、查操作。不足之处(待完善的地方): 1、仍处理开发、相对不稳定阶段; 2、没有日志,不便于排查问题及查看同步结果。 本文深入详解了插件的安装、使用、增删改查同步测试。
343 0