# SQL to query data from ElasticSearch

**URL:** https://discuss.elastic.co/t/sql-to-query-data-from-elasticsearch/10177
**Category:** Elasticsearch
**Created:** [December 26, 2012, 12:56pm UTC](https://discuss.elastic.co/t/sql-to-query-data-from-elasticsearch/10177 "2012-12-26T12:56:03Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![vaidik](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vaidik/32/1134_2.png) [@vaidik](https://discuss.elastic.co/u/vaidik)
#### Post date: [December 26, 2012, 12:56pm UTC](https://discuss.elastic.co/t/sql-to-query-data-from-elasticsearch/10177/1 "2012-12-26T12:56:03Z")

</div>

Hi,

I am looking for a solution to query data indexed in ElasticSearch using  
SQL-like language instead of the ElasticSearch REST API. The solution may  
be something built on top of the the REST API but what I really need is  
just an interface to query data using SQL or something close to SQL without  
having all the features of it.

The reason why I want something like this is because I am working on a  
project wherein I need to expose querying data from ElasticSearch to a very  
small subset of users, who are developers. Since they are developers, SQL  
comes more naturally to them and working with it is rather easy as compared  
to learning a new interface for querying data.

Thanks,  
Vaidik

--

---

<div class="post-metadata">

### Author: ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)
#### Post date: [December 26, 2012, 1:08pm UTC](https://discuss.elastic.co/t/sql-to-query-data-from-elasticsearch/10177/2 "2012-12-26T13:08:04Z")

</div>

I can recommand to use a QueryString query.  
You can use Lucene Query Syntax. You don't need to reinvent the wheel here.

If your users are developpers, they will understand very quick all the basics.

See  
[http://lucene.apache.org/core/4\_0\_0/queryparser/org/apache/lucene/queryparser/classic/package-summary.html#package\_description](http://lucene.apache.org/core/4_0_0/queryparser/org/apache/lucene/queryparser/classic/package-summary.html#package_description)

HTH

Le 26 décembre 2012 à 13:56, Vaidik Kapoor [kapoor.vaidik@gmail.com](mailto:kapoor.vaidik@gmail.com) a écrit :

> Hi,
> 
> I am looking for a solution to query data indexed in Elasticsearch using  
> SQL-like language instead of the Elasticsearch REST API. The solution may be  
> something built on top of the the REST API but what I really need is just an  
> interface to query data using SQL or something close to SQL without having all  
> the features of it.
> 
> The reason why I want something like this is because I am working on a  
> project wherein I need to expose querying data from Elasticsearch to a very  
> small subset of users, who are developers. Since they are developers, SQL  
> comes more naturally to them and working with it is rather easy as compared to  
> learning a new interface for querying data.
> 
> Thanks,  
> Vaidik
> 
> --

--  
David Pilato  
[http://www.scrutmydocs.org/](http://www.scrutmydocs.org/)  
[http://dev.david.pilato.fr/](http://dev.david.pilato.fr/)  
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

--

---

<div class="post-metadata">

### Author: ![Raffaele\_Sena](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/raffaele_sena/32/1759_2.png) [@Raffaele\_Sena](https://discuss.elastic.co/u/Raffaele_Sena)
#### Post date: [December 26, 2012, 4:06pm UTC](https://discuss.elastic.co/t/sql-to-query-data-from-elasticsearch/10177/3 "2012-12-26T16:06:30Z")

</div>

> **[GitHub - raff/elseql: a SQL-like command line client for elasticsearch](https://github.com/raff/elseql)**
>
> a SQL-like command line client for elasticsearch. Contribute to raff/elseql development by creating an account on GitHub.

This is in python, but if you are fine with a command-line tool (or python) it does the job.  
I also have a java version, but didn't have the time to publish it just yet.

-- Raffaele

Sent from my iPad

On Dec 26, 2012, at 4:56 AM, Vaidik Kapoor [kapoor.vaidik@gmail.com](mailto:kapoor.vaidik@gmail.com) wrote:

> Hi,
> 
> I am looking for a solution to query data indexed in Elasticsearch using SQL-like language instead of the Elasticsearch REST API. The solution may be something built on top of the the REST API but what I really need is just an interface to query data using SQL or something close to SQL without having all the features of it.
> 
> The reason why I want something like this is because I am working on a project wherein I need to expose querying data from Elasticsearch to a very small subset of users, who are developers. Since they are developers, SQL comes more naturally to them and working with it is rather easy as compared to learning a new interface for querying data.
> 
> ## Thanks, Vaidik

--

---

<div class="post-metadata">

### Author: ![otisg](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/otisg/32/492_2.png) [@otisg](https://discuss.elastic.co/u/otisg)
#### Post date: [December 27, 2012, 4:05pm UTC](https://discuss.elastic.co/t/sql-to-query-data-from-elasticsearch/10177/4 "2012-12-27T16:05:29Z")

</div>

Hi,

While not a direct answer to your question, see Sensei's BQL - maybe you  
can adapt/borrow from it.

[http://senseidb.com/bql.html](http://senseidb.com/bql.html)

## Otis

ELASTICSEARCH Performance Monitoring - [Sematext Monitoring | Infrastructure Monitoring Service](http://sematext.com/spm/index.html)  
Search Analytics - [Cloud Monitoring Tools & Services | Sematext](http://sematext.com/search-analytics/index.html)

On Wednesday, December 26, 2012 7:56:03 AM UTC-5, Vaidik Kapoor wrote:

> Hi,
> 
> I am looking for a solution to query data indexed in Elasticsearch using  
> SQL-like language instead of the Elasticsearch REST API. The solution may  
> be something built on top of the the REST API but what I really need is  
> just an interface to query data using SQL or something close to SQL without  
> having all the features of it.
> 
> The reason why I want something like this is because I am working on a  
> project wherein I need to expose querying data from Elasticsearch to a very  
> small subset of users, who are developers. Since they are developers, SQL  
> comes more naturally to them and working with it is rather easy as compared  
> to learning a new interface for querying data.
> 
> Thanks,  
> Vaidik

--

---

<div class="post-metadata">

### Author: ![martinspratt](https://avatars.discourse-cdn.com/v4/letter/m/87869e/32.png) [@martinspratt](https://discuss.elastic.co/u/martinspratt)
#### Post date: [October 3, 2014, 1:40am UTC](https://discuss.elastic.co/t/sql-to-query-data-from-elasticsearch/10177/5 "2014-10-03T01:40:46Z")

</div>

Vaidik have you looked at Apache Drill ?

---

<div class="post-metadata">

### Author: ![Johnny\_Wang](https://avatars.discourse-cdn.com/v4/letter/j/9f8e36/32.png) [@Johnny\_Wang](https://discuss.elastic.co/u/Johnny_Wang)
#### Post date: [March 4, 2015, 7:58am UTC](https://discuss.elastic.co/t/sql-to-query-data-from-elasticsearch/10177/6 "2015-03-04T07:58:33Z")

</div>

> **[GitHub - NLPchina/elasticsearch-sql: Use SQL to query Elasticsearch](https://github.com/NLPchina/elasticsearch-sql/)**
>
> Use SQL to query Elasticsearch. Contribute to NLPchina/elasticsearch-sql development by creating an account on GitHub.

This should be your choice i believe.

On Wednesday, December 26, 2012 at 8:56:03 PM UTC+8, Vaidik Kapoor wrote:

> Hi,
> 
> I am looking for a solution to query data indexed in Elasticsearch using  
> SQL-like language instead of the Elasticsearch REST API. The solution may  
> be something built on top of the the REST API but what I really need is  
> just an interface to query data using SQL or something close to SQL without  
> having all the features of it.
> 
> The reason why I want something like this is because I am working on a  
> project wherein I need to expose querying data from Elasticsearch to a very  
> small subset of users, who are developers. Since they are developers, SQL  
> comes more naturally to them and working with it is rather easy as compared  
> to learning a new interface for querying data.
> 
> Thanks,  
> Vaidik

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/44088862-c37f-4f19-bc86-7e8485f8165d%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/44088862-c37f-4f19-bc86-7e8485f8165d%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

### Author: ![savioteles](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/savioteles/32/851_2.png) [@savioteles](https://discuss.elastic.co/u/savioteles)
#### Post date: [March 4, 2015, 2:51pm UTC](https://discuss.elastic.co/t/sql-to-query-data-from-elasticsearch/10177/7 "2015-03-04T14:51:15Z")

</div>

What did you use to parse SQl to Elasticsearch query? Any kind of compiler  
like yacc?

2015-03-04 4:58 GMT-03:00 Johnny Wang [archer.wq@gmail.com](mailto:archer.wq@gmail.com):

> [GitHub - NLPchina/elasticsearch-sql: Use SQL to query Elasticsearch](https://github.com/NLPchina/elasticsearch-sql/)
> 
> This should be your choice i believe.
> 
> On Wednesday, December 26, 2012 at 8:56:03 PM UTC+8, Vaidik Kapoor wrote:
> 
> > Hi,
> > 
> > I am looking for a solution to query data indexed in Elasticsearch using  
> > SQL-like language instead of the Elasticsearch REST API. The solution may  
> > be something built on top of the the REST API but what I really need is  
> > just an interface to query data using SQL or something close to SQL without  
> > having all the features of it.
> > 
> > The reason why I want something like this is because I am working on a  
> > project wherein I need to expose querying data from Elasticsearch to a very  
> > small subset of users, who are developers. Since they are developers, SQL  
> > comes more naturally to them and working with it is rather easy as compared  
> > to learning a new interface for querying data.
> > 
> > Thanks,  
> > Vaidik
> 
> --  
> You received this message because you are subscribed to the Google Groups  
> "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send an  
> email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> To view this discussion on the web visit  
> [https://groups.google.com/d/msgid/elasticsearch/44088862-c37f-4f19-bc86-7e8485f8165d%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/44088862-c37f-4f19-bc86-7e8485f8165d%40googlegroups.com)  
> [https://groups.google.com/d/msgid/elasticsearch/44088862-c37f-4f19-bc86-7e8485f8165d%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/44088862-c37f-4f19-bc86-7e8485f8165d%40googlegroups.com?utm_medium=email&utm_source=footer)  
> .  
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
Regards,

Sávio S. Teles de Oliveira

Co-Founder & Software Engineer at [www.gogeo.io](http://www.gogeo.io).  
PHD student in Computer Science focusing on High Performance Maps Platform  
and Spatial Algorithms.  
voice: +55 62 9136 6996  
[http://br.linkedin.com/in/savioteles](http://br.linkedin.com/in/savioteles)  
[https://twitter.com/savioteless](https://twitter.com/savioteless)

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CAFKmhPvVd\_7JLZ\_ZPe7HcRLRDe5JyphRcbjbZjY\_cp2Ya4H%3DvA%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAFKmhPvVd_7JLZ_ZPe7HcRLRDe5JyphRcbjbZjY_cp2Ya4H%3DvA%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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 6, 2017, 12:28am UTC](https://discuss.elastic.co/t/sql-to-query-data-from-elasticsearch/10177/8 "2017-07-06T00:28:35Z")

</div>


