# Some Issue in sql query with elasticsearch database

**URL:** <https://discuss.elastic.co/t/some-issue-in-sql-query-with-elasticsearch-database/114283>\
**Category:** Elasticsearch\
**Created:** [January 5, 2018, 12:29pm UTC](https://discuss.elastic.co/t/some-issue-in-sql-query-with-elasticsearch-database/114283 "2018-01-05T12:29:31Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Devanshu\_Sharma](https://avatars.discourse-cdn.com/v4/letter/d/f6c823/32.png) [@Devanshu\_Sharma](https://discuss.elastic.co/u/Devanshu_Sharma)\
**Post date:** [January 5, 2018, 12:29pm UTC](https://discuss.elastic.co/t/some-issue-in-sql-query-with-elasticsearch-database/114283/1 "2018-01-05T12:29:31Z")

</div>

if i have run any sql query without column name space then It is successfully run.  
If i have run any sql query have space in column name that time it showing sql parse error.

Example 1. without space in column name that one executed  
sql = SELECT t0._,t1._ FROM 106659841v1 t0 INNER JOIN 106659841v1 t0 ON (t0.customerid = t0.customerid)

Example 2 if i have run sql query with space in column name that one showing error

sql query = SELECT t0._,t1._ FROM 109248515v1 t0 INNER JOIN 109248514v1 t1 ON (t0.customerid = t1.`order id`)  
error = com.alibaba.druid.sql.parser.ParserException: syntax error, expect RPAREN, actual IDENTIFIER `order id`

if that one query execute in mysql or any database that time is run successfully.

that one issue in java prog. lang.

code : - SearchDao searchDao = new SearchDao(esClient);  
SqlElasticRequestBuilder explain = searchDao.explain(query).explain();  
ElasticJoinExecutor executor = ElasticJoinExecutor.createJoinExecutor(searchDao.getClient(),explain);  
executor.run();

esClient is config. of elasticsearch database.  
query is simple sql query.  
Please give me any solution and thanks for answer

---

<div class="post-metadata">

**Author:** ![thiago](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/thiago/32/32096_2.png) [@thiago](https://discuss.elastic.co/u/thiago)\
**Post date:** [January 6, 2018, 7:52pm UTC](https://discuss.elastic.co/t/some-issue-in-sql-query-with-elasticsearch-database/114283/2 "2018-01-06T19:52:17Z")

</div>

Hey there. Elasticsearch does not accepts SQL queries natively (yet). It seems that you are trying access Elasticsearch using some third-party library that seems to convert SQL into native Elasticsearch query.

The error is coming from this third-party library (apparently is this one [https://github.com/alibaba/druid](https://github.com/alibaba/druid)). I suggest that you either try StackOverflow or reach out the library's author directly.

---

<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:** [February 3, 2018, 7:59pm UTC](https://discuss.elastic.co/t/some-issue-in-sql-query-with-elasticsearch-database/114283/3 "2018-02-03T19:59:01Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
