Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/qxip/elasql
Generic SQL to Elasticsearch DSL query translator
https://github.com/qxip/elasql
convert dsl elastic elasticsearch nodejs query sql translate
Last synced: 3 days ago
JSON representation
Generic SQL to Elasticsearch DSL query translator
- Host: GitHub
- URL: https://github.com/qxip/elasql
- Owner: QXIP
- License: mit
- Created: 2018-05-06T22:55:59.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2021-06-21T11:41:26.000Z (over 3 years ago)
- Last Synced: 2024-10-31T02:19:56.873Z (16 days ago)
- Topics: convert, dsl, elastic, elasticsearch, nodejs, query, sql, translate
- Language: JavaScript
- Homepage: http://qxip.net
- Size: 10.7 KB
- Stars: 23
- Watchers: 1
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# {ela}sql
Generic SQL to Elasticsearch DSL query translator. Designed for [SENTINL](https://github.com/sirensolutions/sentinl)
### Status
* Experimental - Join us hacking this!## Installation
```
npm install elasql
```## Usage
```
const convert = require('elasql').convert
convert('SELECT id,name FROM shop WHERE shop_id BETWEEN 5 AND 10 AND type = "cat"')
```
##### Output
```
{
"query": {
"bool": {
"must": [
{
"match": {
"type": "cat"
}
}
],
"must_not": [],
"filter": [
{
"range": {
"shop_id": {
"gte": {
"type": "number",
"value": 5
},
"lte": {
"type": "number",
"value": 10
}
}
}
}
]
}
},
"aggregations": {
"id": {
"terms": {
"field": "id"
},
"aggregations": {
"name": {
"terms": {
"field": "name"
}
}
}
}
}
}```
### License
(C) QXIP BV 2018, released under the MIT License