Some Issue in sql query with elasticsearch database


(Devanshu Sharma) #1

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


(Thiago Souza) #2

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). I suggest that you either try StackOverflow or reach out the library's author directly.


(system) #3

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