1

jdbc River 插件,在简单策略模式下,会在添加新行时更新索引,但是如果字段值发生变化,它是否会更新现有行?我注意到数据库中没有任何时间戳字段的映射,所以我认为它没有。

4

1 回答 1

0

您可以在查询中使用时间戳,方法$river.state.last_active_begin如下例所示。这将获取自上次河流运行以来添加的产品行。

{
  "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"
  }
}
于 2015-03-25T21:13:23.433 回答