explaingit

nlpchina/elasticsearch-sql

7,016JavaAudience · dataComplexity · 3/5Setup · moderate

TLDR

An Elasticsearch plugin that lets you query your data using standard SQL instead of its complex nested JSON format, write SELECT, WHERE, and GROUP BY statements and the plugin translates them automatically.

Mindmap

mindmap
  root((elasticsearch-sql))
    What it does
      SQL queries
      JSON translation
      Browser UI
    SQL features
      WHERE filters
      GROUP BY
      JOIN operations
    Status
      Deprecated
      Legacy use only
    Alternatives
      x-pack SQL
      OpenDistro SQL
    Audience
      Data analysts
      Database users
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Query Elasticsearch log data with familiar SQL statements instead of writing deeply nested JSON query objects.

USE CASE 2

Run GROUP BY aggregations and ORDER BY sorting on Elasticsearch indices using SQL syntax you already know.

USE CASE 3

Use the built-in browser interface to explore Elasticsearch data interactively without writing any code.

Tech stack

JavaElasticsearch

Getting it running

Difficulty · moderate Time to first run · 30min

Project is deprecated, use the official Elasticsearch x-pack SQL or AWS OpenDistro SQL for new projects.

In plain English

Elasticsearch is a system for storing and searching large amounts of data very quickly. It is popular for log analysis, product search, and similar tasks. However, its native query language is expressed as deeply nested JSON documents, which can be cumbersome to write. This project is an Elasticsearch plugin that lets you query it using SQL instead, the same kind of query language that spreadsheet users and database administrators already know. Once installed as a plugin, the server accepts SQL statements sent as HTTP requests and translates them into Elasticsearch's native query format internally. You can write queries with WHERE conditions, GROUP BY aggregations, ORDER BY sorting, and JOIN operations across indices. The plugin also includes a simple web frontend that lets you type SQL queries in a browser and see results without writing any code. It is important to know upfront that this project is deprecated. The README states clearly that active development has stopped and recommends switching to the official SQL feature built into Elasticsearch (called x-pack SQL, included in modern Elasticsearch versions) or the OpenDistro for Elasticsearch SQL plugin maintained by AWS. Both of those replacements are actively maintained and cover the same functionality. The repository has maintained compatibility branches for a very long range of Elasticsearch versions, from version 1.x through version 9.x, which explains the long version table in the README. Each Elasticsearch major or minor version requires a matching plugin version, so you choose the branch that corresponds to your Elasticsearch installation. For anyone already using this plugin in a legacy system, the code remains available and the build still passes for recent Elasticsearch versions, but for new projects the official alternatives are the better choice. The full README is longer than what was shown.

Copy-paste prompts

Prompt 1
Show me how to install the elasticsearch-sql plugin for my Elasticsearch version and run a basic SELECT query against an index.
Prompt 2
Help me write an elasticsearch-sql GROUP BY query to count log events by date and status code.
Prompt 3
I need to migrate from elasticsearch-sql to the official Elasticsearch x-pack SQL, show me how to convert my existing queries.
Prompt 4
Show me how to send a SQL query to the elasticsearch-sql HTTP endpoint from Python and parse the JSON response.
Open on GitHub → Explain another repo

← nlpchina on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.