Skip to content

Instantly share code, notes, and snippets.

@ondrej-kvasnovsky
Last active December 26, 2015 19:49
Show Gist options
  • Save ondrej-kvasnovsky/7204476 to your computer and use it in GitHub Desktop.
Save ondrej-kvasnovsky/7204476 to your computer and use it in GitHub Desktop.
JDBC river from MySql to ElasticSearch
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"}
}
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment