Image by icons8 Creative Commons Attribution-NoDerivs 3.0 Unported.
The Java Database Connection (JDBC) river allows to fetch data from JDBC sources for indexing into Elasticsearch.
It is implemented as an Elasticsearch plugin.
The relational data is internally transformed into structured JSON objects for the schema-less indexing model in Elasticsearch.
Creating a JDBC river is easy. Install the plugin. Download a JDBC driver jar from your vendor's site (here MySQL) and put the jar into the folder of the plugin $ES_HOME/plugins/river-jdbc. Then issue this command:
curl -XPUT 'localhost:9200/_river/my_jdbc_river/_meta' -d '{ "type" : "jdbc", "jdbc" : { "driver" : "com.mysql.jdbc.Driver", "url" : "jdbc:mysql://localhost:3306/test", "user" : "", "password" : "", "sql" : "select * from orders", "index" : "my_jdbc_index", "type" : "my_jdbc_type" } }'
Prerequisites
- Elasticsearch 0.90+
- a JDBC driver jar for your database (download from vendor site and put into JDBC river plugin folder)
ES version | Plugin | Release date | Command |
0.90.5 | 2.2.2 | Oct 13, 2013 | ./bin/plugin -install river-jdbc -url http://bit.ly/1iovWV9 |
0.90.7 | 2.2.3 | Nov 21, 2013 | ./bin/plugin -install river-jdbc -url http://bit.ly/I7kz9q |
0.90.7 | 2.2.4 | Dec 8, 2013 | ./bin/plugin -install river-jdbc -url http://bit.ly/1f95nE4 |
0.90.7 | 2.3.1 | Dec 14, 2013 | ./bin/plugin -install river-jdbc -url http://bit.ly/1ctvKka |
Do not forget to restart the node after installing.
The Maven project site is available at Github
Binaries are available at Bintray
RiverSource, RiverMouth, RiverFlow
Setting up the river with PostgreSQL
Elasticsearch JDBC River Plugin
Copyright (C) 2012,2013 Jörg Prante
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.