# \[ANNOUNCEMENT\] es-sql 2.0.0 Query Elasticsearch using SQL

**URL:** <https://discuss.elastic.co/t/announcement-es-sql-2-0-0-query-elasticsearch-using-sql/43062>\
**Category:** Community Ecosystem\
**Created:** [March 1, 2016, 1:03am UTC](https://discuss.elastic.co/t/announcement-es-sql-2-0-0-query-elasticsearch-using-sql/43062 "2016-03-01T01:03:10Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![taowen](https://avatars.discourse-cdn.com/v4/letter/t/6f9a4e/32.png) [@taowen](https://discuss.elastic.co/u/taowen)\
**Post date:** [March 1, 2016, 1:03am UTC](https://discuss.elastic.co/t/announcement-es-sql-2-0-0-query-elasticsearch-using-sql/43062/1 "2016-03-01T01:03:10Z")

</div>

> **[taowen/es-monitor](https://github.com/taowen/es-monitor)**
>
> es-monitor - query metric from elasticsearch using sql

We love SQL and want to leverage the full power of elasticsearch. Using syntax like

```auto
$ cat << EOF | es-sql http://127.0.0.1:9200
    WITH all_symbols AS (SELECT MAX(market_cap) AS max_all_times FROM symbol);
    WITH year_2000 AS (SELECT MAX(market_cap) AS max_at_2000 FROM all_symbols 
        WHERE ipo_year=2000)
EOF

```

You can create drill-down aggregation without deeply nested json

It is written in Python, it can be:

- a python library to query elasticsearch ( [https://pypi.python.org/pypi/es-sql](https://pypi.python.org/pypi/es-sql) )
- a console command
- a http server providing SQL api
- we also use it to monitor Elasticsearch cluster itself, even querying metric from Elasticsearch to monitor business

If you like Java, there is also a Java version coming.

Compared to 1.x version, the WITH statement is changed to abide SQL syntax convention ( from WITH xxx AS yyy to WITH yyy AS (xxx) )

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 5, 2017, 9:47pm UTC](https://discuss.elastic.co/t/announcement-es-sql-2-0-0-query-elasticsearch-using-sql/43062/2 "2017-07-05T21:47:40Z")

</div>


