es拉取mysql的增量更新代码

基于开源插件。具体可参考http://my.oschina.net/qiangzigege/blog/220224

~~~~~~

目的:实现增量更新

原理

1)第一次全量更新,更新完毕后,删除这个任务。

2)发布增量更新任务即可。

~~~~~~~~~

增量更新任务的模板如下:

 curl -XPUT 'ip:9200/_river/my_jdbc_river/_meta' -d '{
"type":"jdbc",
"jdbc":
{
"url":"jdbc:mysql://IP:3306/fastooth",
"user":"dewmobile",
"password":"dewmobile",
"sql":"select * from users where updated_at between UNIX_TIMESTAMP(now())*1000-60000 86400000 and UNIX_TIMESTAMP(now())*1000 or created_at between UNIX_TIMESTAMP(now())*1000-60000 86400000 and UNIX_TIMESTAMP(now())*1000",
"schedule":"0 0-59 0-23 * * ?",
"index":"ccc",
"type":"ddd"
}
}
'

 

你可能感兴趣的:(elasticsearch)