farmerx / Elasticsql
Licence: mit
ElasticSQL package converts SQL to ElasticSearch DSL
Stars: ✭ 77
Programming Languages
go
31211 projects - #10 most used programming language
Projects that are alternatives of or similar to Elasticsql
Esparser
PHP write SQL to convert DSL to query Elasticsearch
Stars: ✭ 142 (+84.42%)
Mutual labels: sql, elasticsearch
Dataux
Federated mysql compatible proxy to elasticsearch, mongo, cassandra, big-table, google datastore
Stars: ✭ 268 (+248.05%)
Mutual labels: sql, elasticsearch
Xsql
Unified SQL Analytics Engine Based on SparkSQL
Stars: ✭ 176 (+128.57%)
Mutual labels: sql, elasticsearch
Elasticsearch
Use SQL statements to query elasticsearch
Stars: ✭ 98 (+27.27%)
Mutual labels: sql, elasticsearch
Elasticsearch Sql
Use SQL to query Elasticsearch
Stars: ✭ 6,563 (+8423.38%)
Mutual labels: sql, elasticsearch
Elasticsearch Sql
parse sql into elasticsearch dsl with antlr4
Stars: ✭ 127 (+64.94%)
Mutual labels: sql, elasticsearch
Elastichd
Elasticsearch 可视化DashBoard, 支持Es监控、实时搜索,Index template快捷替换修改,索引列表信息查看, SQL converts to DSL等
Stars: ✭ 2,993 (+3787.01%)
Mutual labels: sql, elasticsearch
Legacy Search
Demo project showing how to add elasticsearch to a legacy application.
Stars: ✭ 103 (+33.77%)
Mutual labels: sql, elasticsearch
Elasticsql
convert sql to elasticsearch DSL in golang(go)
Stars: ✭ 687 (+792.21%)
Mutual labels: sql, elasticsearch
Opserver
Stack Exchange's Monitoring System
Stars: ✭ 4,126 (+5258.44%)
Mutual labels: sql, elasticsearch
Aspnetcorenlog
ASP.NET Core NLog MS SQL Server PostgreSQL MySQL Elasticsearch
Stars: ✭ 54 (-29.87%)
Mutual labels: sql, elasticsearch
Zombodb
Making Postgres and Elasticsearch work together like it's 2021
Stars: ✭ 3,781 (+4810.39%)
Mutual labels: sql, elasticsearch
Tf aws elasticsearch
Terraform module which creates AWS Elasticsearch resources
Stars: ✭ 73 (-5.19%)
Mutual labels: elasticsearch
Locopy
locopy: Loading/Unloading to Redshift and Snowflake using Python.
Stars: ✭ 73 (-5.19%)
Mutual labels: sql
Helm Elasticstack
Kubernetes Helm Charts and Tools to run Elastic Stack(ELK) on Azure Container Service(AKS)
Stars: ✭ 76 (-1.3%)
Mutual labels: elasticsearch
ElasticSQL
ElasticSQL package converts SQL to ElasticSearch DSL
SQL Features Support:
- [x] SQL Select
- [x] SQL Where
- [x] SQL Order By
- [x] SQL Group By
- [x] SQL AND & OR
- [x] SQL Like & NOT Like
- [x] SQL COUNT distinct count(distinct(mid))
- [x] SQL In & Not In
- [x] SQL Between
- [x] SQL avg(field)、count(*), count(field), min(field), max(field)
Beyond SQL Features Support:
- [x] ES TopHits
- [x] ES date_histogram |||
date_histogram(field="changeTime", _interval="1h", format="yyyy-MM-dd HH:mm:ss")
- [x] ES histogram |||
histogram(field="grade", _interval="10")
- [x] ES STATS |||
stats(field="grade")
- [x] ES RANGE |||
range(field="age", range="20,25,30,35,40")
- [x] ES DATE_RANGE |||
date_range(field="insert_time", format="yyyy-MM-dd" ,range="2014-08-18, 2014-08-17, now-6d,now")
Improvement : now the query DSL is much more flat
SQL Usage
Query
select * from test where a=1 and b="c" and create_time between '2015-01-01T00:00:00+0800' and '2016-01-01T00:00:00+0800' and process_id > 1 order by id desc limit 100,10
Aggregation
select avg(age),min(age),max(age), count(student), count(distinct student) from test group by grade,class limit 10
Beyond SQL
-
range age group 20-25,25-30,30-35,35-40
SELECT COUNT(age) FROM bank GROUP BY range(field="age", range="20,25,30,35,40")
-
range date group by your config
SELECT online FROM online GROUP BY date_range(field="insert_time",format="yyyy-MM-dd" ,range="2014-08-18,2014-08-17,now-8d,now-7d,now-6d,now")
-
range date group by day
select * from test group by date_histogram(field="changeTime", _interval="1h", format="yyyy-MM-dd HH:mm:ss")
-
stats
SELECT online FROM online group by stats(field="grade")
-
topHits
select top_hits(field="class", hitssort="age:desc", taglimit = "10", hitslimit = "1", _source="name,age,class,gender") from school
PKG Usage
go get github.com/farmerx/elasticsql
Demo :
package main
import (
"fmt"
"github.com/farmerx/elasticsql"
)
var sql = `
select * from test where a=1 and b="c" and create_time between '2015-01-01T00:00:00+0800' and '2016-01-01T00:00:00+0800' and process_id > 1 order by id desc limit 100,10
`
var sql2= `
select avg(age),min(age),max(age),count(student) from test group by class limit 10
`
var sql3= `
select * from test group by class,student limit 10
`
var sql4 = `
select * from test group by date_histogram(field="changeTime",interval="1h",format="yyyy-MM-dd HH:mm:ss")
`
func main() {
esql := elasticsql.NewElasticSQL(eslasticsql.InitOptions{})
table, dsl, err := esql.SQLConvert(sql)
fmt.Println(table, dsl, err)
}
OUTPUT
date_historgram
{
"query": {
"bool": {
"must": [
{
"match_all": {}
}
]
}
},
"from": 0,
"size": 0,
"aggregations": {
"date_histogram": {
"date_histogram": {
"field": "changeTime",
"format": "yyyy-MM-dd HH:mm:ss",
"interval": "1h"
}
}
}
}
date_range
{
"query": {
"bool": {
"must": [
{
"match_all": {}
}
]
}
},
"from": 0,
"size": 0,
"aggregations": {
"date_range": {
"range": {
"field": "insert_time",
"ranges": [
{
"format": "yyyy-MM-dd",
"from": "2014-08-18",
"to": "2014-08-17"
},
{
"format": "yyyy-MM-dd",
"from": "2014-08-17",
"to": "now-8d"
},
{
"format": "yyyy-MM-dd",
"from": "now-8d",
"to": "now-7d"
},
{
"format": "yyyy-MM-dd",
"from": "now-7d",
"to": "now-6d"
},
{
"format": "yyyy-MM-dd",
"from": "now-6d",
"to": "now"
},
{
"format": "yyyy-MM-dd",
"from": "now"
}
]
}
}
}
}
...
Licenses
This program is under the terms of the MIT License. See LICENSE for the full license text.
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].