Updated for new version of ElasticSearch 1.0.0.
JDBC river makes possible to load data from e.g. MySql database to ElasticSearch and provide data much faster.
Before we start, have a look at the set of jdbc-river parameters. Then you need to pick-up a strategy how to poll data from JDBC.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PUT /_river/jdbc_river_1/_meta | |
{ | |
"type" : "jdbc", | |
"jdbc" : { | |
"url": "jdbc:mysql://localhost:3306/yourDb", | |
"user": "login", | |
"password": "pass", | |
"sql" : "SELECT * FROM Transactions WHERE user_id = 1", | |
"index" : "my_jdbc_index", | |
"type" : "my_jdbc_type", | |
"bulk_size": 5000, | |
"max_bulk_requests": 30, | |
"type_mapping": { | |
"my_jdbc_type": { | |
"properties": { | |
"myInvoicePrice": {"type": "double"}, | |
"customer": {"type": "string","store": true,"index": "not_analyzed"}, | |
"created": {"type": "date","store": true}, | |
"dataset_id": {"type": "long"} | |
} | |
} | |
} | |
} | |
} | |
} |
Hi, shouldn't index_name be index_type in your example?
ReplyDeletein the type_mapping?
ReplyDeleteIt was actually working as it is. ES river has changed this? I couldn't find it in documentation.
ReplyDeletedon't know, i got it working but used the type index_type, maybe it works because there is no other type in the index. Anyways, thanks for this post.
ReplyDeleteYou are right, index_type must be used... I fixed it.
ReplyDeletedo u need to create an empty index first? mine is not honoring my mappings. what do you mean by index_type? i don't see that in your example.
ReplyDelete