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 simple command:
curl -XPUT 'localhost:9200/_river/my_jdbc_river/_meta' -d '{
"type" : "jdbc",
"jdbc" : {
"url" : "jdbc:mysql://localhost:3306/test",
"user" : "",
"password" : "",
"sql" : "select * from orders",
"index" : "my_jdbc_index",
"type" : "my_jdbc_type"
}
}'
Reference :-