Open ayyagari opened 10 years ago
FWIW, I finally ended up using feeder script like the below to sync up data. The key thing was to figure out what "_id" would be (it should be one or more column values taken together to form a unique key). "schedule" added below is to run feeder every 30 seconds.
{
"elasticsearch" : {
"cluster" : "elk-cluster",
"host" : elkhost.company.com"
},
"type" : "jdbc",
"schedule" : "0/30 0-59 0-23 ? * *",
"jdbc" : {
"url" : "jdbc:hsqldb:hsql://localhost:9001/xdb",
"driver" : "org.hsqldb.jdbc.JDBCDriver",
"user" : "sa",
"password" : "",
"sql" : "select column1+column3 as \"_id\", column1, column2, column3, column4 from public.observed_table",
"strategy" : "simple",
"autocommit" : true,
"index" : "myindex",
"type" : "mytype",
"versioning" : "true"
}
}
You could've done something like this: { "statement" : "select * from public.observed_table where (? = 1) or (? > 1 and timestamp > ?)", "parameter" : [ "$river.state.counter ","$river.state.counter ","$river.state.last_active_begin" ] }
I would like to use river in feeder mode (pushing the changes to elasticsearch) by observing inserts into a database table. Here is the relevant configuration section from my feeder script: "jdbc" : { ... "url" : "jdbc:hsqldb:hsql://localhost:9001/xdb", "sql" : [ { "statement" : "select * from public.observed_table where timestamp > ?", "parameter" : [ "$river.state.last_active_begin" ] } ], ... }
I see multiple issues with this approach:
Any insights/suggestions are greatly appreciated!
-Madhav