使用ElasticSearch JDBC River从表中获取更改 [英] Fetching changes from table with ElasticSearch JDBC river

查看:145
本文介绍了使用ElasticSearch JDBC River从表中获取更改的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为ElasticSearch配置JDBC River,但我找不到任何好的配置示例。
我已经阅读了所有页面 elasticsearch-river-jdbc GitHub。



I有一个SQL查询,我需要每X秒从所有表列中获取更改。如何告诉JDBC River有些行被更改,应该重新编号?



在ES服务器启动期间获取数据,轮询正在发生,但是没有从数据库中获取更改到ES。



我的配置:

  curl -XPUT'localhost :
jdbc:{
driver:com.mysql.jdbc.Driver
url:jdbc:mysql://mydb.com:3306 / dbname,
user:yyy,
password:xxx
sql:SELECT ii.id AS _id,ii.id AS myid,... FROM ... LEFT JOIN .. ON ...,
poll:6s ,
strategy:simple
},
index:{
index:invoiceitems,
bulk_size:600,
max_bulk_requests:10,
bulk_timeout:5s,
}
}'

谢谢。

解决方案

添加


autocommit:true


在索引设置中。那么问题就会解决


I'm configuring JDBC river for ElasticSearch but I can't find any good config example. I've read all pages on elasticsearch-river-jdbc GitHub.

I have a SQL query and I need to fetch changes from all table columns every X seconds. How can I tell JDBC river that some row is changed and should be reindexed?

Data are fetched during ES server start, polling is happening, but changes are not fetched from DB to ES.

My configuration:

curl -XPUT 'localhost:9200/_river/itemsi/_meta' -d '{
"type" : "jdbc",
"jdbc" : {
    "driver" : "com.mysql.jdbc.Driver",
    "url" : "jdbc:mysql://mydb.com:3306/dbname",
    "user" : "yyy",
    "password" : "xxx",
    "sql" : "SELECT ii.id AS _id, ii.id AS myid, ... FROM ... LEFT JOIN .. ON...",
    "poll" : "6s",
    "strategy" : "simple"
    },
"index" : {
    "index" : "invoiceitems",
    "bulk_size" : 600,
    "max_bulk_requests" : 10,
    "bulk_timeout" : "5s",
    }
}'

Thank you.

解决方案

Add

"autocommit" : true

in index settings. Then the problem will be resolved

这篇关于使用ElasticSearch JDBC River从表中获取更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆