# Doesn't The elasticsearch-jdbc support the sql statement like "select \* from a join b where a.id = b.id where a.id = 1"?

**URL:** <https://discuss.elastic.co/t/doesnt-the-elasticsearch-jdbc-support-the-sql-statement-like-select-from-a-join-b-where-a-id-b-id-where-a-id-1/38733>\
**Category:** Elasticsearch\
**Created:** [January 8, 2016, 2:23pm UTC](https://discuss.elastic.co/t/doesnt-the-elasticsearch-jdbc-support-the-sql-statement-like-select-from-a-join-b-where-a-id-b-id-where-a-id-1/38733 "2016-01-08T14:23:01Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![miracle24](https://avatars.discourse-cdn.com/v4/letter/m/c4cdca/32.png) [@miracle24](https://discuss.elastic.co/u/miracle24)\
**Post date:** [January 8, 2016, 2:23pm UTC](https://discuss.elastic.co/t/doesnt-the-elasticsearch-jdbc-support-the-sql-statement-like-select-from-a-join-b-where-a-id-b-id-where-a-id-1/38733/1 "2016-01-08T14:23:01Z")

</div>

I try to import some data with some costraint from the mysql to ES.Here is my shell code:  
`echo ' { "type" : "jdbc", "jdbc" : { "url" : "jdbc:mysql://localhost:3306/test", "user" : "root", "password" : "miracle", "locale" : "en_US", "sql" : "select a.aid as _id,a.aid as \"a.aid\",a.anum as \"a.anum\",b.bid as \"b.bid\",b.bnum as \"b.bnum\" from a left join b on a.aid = b.bid where a.id <= 100", "elasticsearch" : { "cluster" : "fycluster", "host" : "localhost", "port" : 9300 }, "index" : "testa", "type" : "testb", "index_settings" : { "index" : { "number_of_replicas" : 1 } }, "type_mapping": { "testb":{ "properties":{ "a":{ "properties":{ "aid":{"type":"integer"}, "anum":{"type":"string"} } }, "b":{ "properties":{ "bid":{"type":"integer"}, "bnum":{"type":"string"} } } } } } } } ' | java \ -cp "${lib}/*" \ -Dlog4j.configurationFile=${bin}/log4j2.xml \ org.xbib.tools.Runner \ org.xbib.tools.JDBCImporter curl -XGET 'localhost:9200/testa/_refresh'`  
It is curious that when I use sql statement '`select a.aid as _id,a.aid as \"a.aid\",a.anum as \"a.anum\",b.bid as \"b.bid\",b.bnum as \"b.bnum\" from a left join b on a.aid = b.bid limit 1,100`'it works fine.  
Thank you very much!

---

<div class="post-metadata">

**Author:** ![jprante](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jprante/32/44941_2.png) [@jprante](https://discuss.elastic.co/u/jprante)\
**Post date:** [January 8, 2016, 6:41pm UTC](https://discuss.elastic.co/t/doesnt-the-elasticsearch-jdbc-support-the-sql-statement-like-select-from-a-join-b-where-a-id-b-id-where-a-id-1/38733/2 "2016-01-08T18:41:48Z")

</div>

This is a specific MySQL question related to JDBC import, you can of course always ask questions at [https://github.com/jprante/elasticsearch-jdbc/issues](https://github.com/jprante/elasticsearch-jdbc/issues) or a MySQL forum.

Both variants are fine as they are passed unmodified to MySQL. The result depends on your DB data.

---

<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, 11:25pm UTC](https://discuss.elastic.co/t/doesnt-the-elasticsearch-jdbc-support-the-sql-statement-like-select-from-a-join-b-where-a-id-b-id-where-a-id-1/38733/3 "2017-07-05T23:25:54Z")

</div>


