I'm using the JDBC plugin for ElasticSearch to update my MySQL database. It picks up new and changed records, but does not delete records that have been removed from MySQL. They remain in the index.
This is the code I use to create the river:
curl -XPUT 'localhost:9200/_river/account_river/_meta' -d '{
"type" : "jdbc",
"jdbc" : {
"driver" : "com.mysql.jdbc.Driver",
"url" : "jdbc:mysql://localhost:3306/test",
"user" : "test_user",
"password" : "test_pass",
"sql" : "SELECT `account`.`id` as `_id`, `account`.`id`, `account`.`reference`, `account`.`company_name`, `account`.`also_known_as` from `account` WHERE NOT `account`.`deleted`",
"strategy" : "simple",
"poll" : "5s",
"versioning" : true,
"digesting" : false,
"autocommit" : true,
"index" : "headphones",
"type" : "Account"
}
}'
Installed ElasticSearch via homebrew on OSX Mountain Lion, no errors or problems and everything responds as expected. Permissions OK, no errors in logs.
I have removed, and included (and set to true and false) every combination of autocommit
, versioning
and digesting
that I could think of. It's a dev database so I'm sure that records are deleted fully, not cached and not soft-deleted. If I delete all the records (i.e. leave the river intact and just delete what was indexed on ES), the next time the river updates it does not re-add the record, which leads me to believe I have missed something regarding versioning and deleting.
Note I've also tried various ways to specify the _id
column, and I checked that it had a value via JSON on call.
Cheers.