Elasticsearch SQL
-
Added in Elasticseach 6.3
-
SQL query
- Unresolved AST
- Resolved plan
- Optimized plan
- Physical plan
-
Results
-
indexes
turn intotables
documents
turn intorows
curl -s "localhost:9200/_sql?format=txt" \
--request GET \
--header "Content-Type: application/json" \
--data @sql.json
{
"query": "DESCRIBE movies"
}
{
"query": "SELECT title FROM movies LIMIT 10"
}
{
"query": "SELECT title, year FROM movies WHERE year < 1920 ORDER BY year"
}
Translate sql to conventional json query
curl -s "localhost:9200/_sql/translate" \
--request GET \
--header "Content-Type: application/json" \
--data @sql.json \
| jq .
Elasticsearch SQL CLI
/usr/share/elasticsearch/bin/elasticsearch-sql-cli