Open Judyccb opened 8 years ago
This feature is outside of JDBC importer. Create index template in ES, and use it from JDBC importer by
select myindexname as _index, ... from table ...
where myindexname
is the index name that matches the pattern configured in the index template.
Thanks for your help. 1、where should I define the command "select myindexname as _index, ... from table ..."?in the JDBC importer definition file? What I want to do is import data of table "aaa" from Oracle to ES, Do you mean I should change "select * from aaa " in JDBC importer definition file into " select abc-index as _index from (select * from aaa)"?. I'm confused. 2、Could you give me an example? Thanks for your patience again!
Of course you must define the SQL statement of the JDBC importer.
select * from aaa
is a naive example SQL which works, but it does not address Elasticsearch index, type, or id. It is just a simple test. The asterisk *
is not suitable for Elasticsearch field names either.
To create Elasticsearch documents, you need something like select myindexname as _index, mytypename as _type, mydocumentid as _id, myvalue1 as fieldname, myvalue2 ... from aaa where ...
The pseudo column names beginning with _
are documented at https://github.com/jprante/elasticsearch-jdbc
You can freely choose myindexname, mytypename, etc. as you like, as literals or values from DB.
My ES version is 1.4.4,jdbc-importer version is 1.7.3 My problem is: I do not want to define "index_settings" or "type_mapping" in JDBC importer definition file,I want to define them in ES template.does jdbc-importer 1.7.3 support it?