The jdbc river plugin, on the simple strategy mode, does update the index as new rows are added, but does it update the existing rows if there are changes in the field values? I notice that there is no mapping with any timestamp field in the database so I presume its not.
Asked
Active
Viewed 721 times
1
-
2it updates the documents or overwrite them, depends on versioning. – shyos Jan 22 '14 at 11:33
-
1some good info in this other recent answer about the jdbc river processing [other answer/question here](http://stackoverflow.com/questions/21260086/elasticsearch-river-jdbc-mysql-not-deleting-records) – mconlin Jan 22 '14 at 19:35
-
Yes, thanks, I understand how it works now. Basically it re-executes the query again and based on the delta, update the document again with the new version if needed. – dickyj Jan 23 '14 at 03:17
1 Answers
0
You can use timestamps within your query by using the $river.state.last_active_begin
as in the below example. This would fetch product rows which have been added since the last river run.
{
"type": "jdbc",
"jdbc": {
"url": "jdbc:mysql://localhost:3306/test",
"user": "",
"password": "",
"sql": [
{
"statement": "select * from \"products\" where \"mytimestamp\" > ?",
"parameter": [
"$river.state.last_active_begin"
]
}
],
"index": "my_jdbc_river_index",
"type": "my_jdbc_river_type"
}
}

Igor Yavych
- 4,166
- 3
- 21
- 42

user2040074
- 634
- 1
- 5
- 16