0

When using https://github.com/jprante/elasticsearch-river-jdbc I notice that the following curl statement successfully indexes data the first time. However, the river fails to repeatedly poll the database for updates.

To restate, when I run the following, the river successfully connects to MySQL, runs the query successfully, indexes the results, but never runs the query again.

curl -XPUT '127.0.0.1:9200/_river/projects_river/_meta' -d '{
"type" : "jdbc",
"index" : {
    "index" : "test_projects",
    "type" : "project",
    "bulk_size" : 100,
    "max_bulk_requests" : 1,
    "autocommit": true
    },
"jdbc" : {
    "driver" : "com.mysql.jdbc.Driver",
    "poll" : "1m",
    "strategy" : "simple",
    "url" : "jdbc:mysql://localhost:3306/test",
    "user" : "root",
    "sql" : "SELECT name, updated_at from projects p where p.updated_at > date_sub(now(),interval 1 minute)"
    }
}'

Tailing the log, I see:

[2013-09-27 16:32:24,482][INFO ][org.elasticsearch.river.jdbc.strategy.simple.SimpleRiverFlow] next run, waiting 1m [2013-09-27 16:33:24,488][INFO ]> [org.elasticsearch.river.jdbc.strategy.simple.SimpleRiverFlow] next run, waiting 1m [2013-09-27 16:34:24,494][INFO ]> [org.elasticsearch.river.jdbc.strategy.simple.SimpleRiverFlow] next run, waiting 1m

But the index stays empty. Running on a macbook pro with elasticsearch version stable 0.90.2, HEAD and mysql-connector-java-5.1.25-bin.jar in the river pligns directory.

4

1 回答 1

0

我认为,如果您将策略值从“简单”切换到“轮询”,您可能会得到您正在寻找的东西——它在针对 MS SQL 的那个版本的弹性搜索上使用 jdbc 对我有用。

此外 - 您需要选择一个字段作为 _id(选择主键作为 _id),因为这在弹性搜索河中用于确定添加/删除/更新哪些记录。

于 2013-10-03T04:07:33.663 回答