使用 elasticsearch river 创建索引

creating index with elasticsearch river

我正在尝试从数据库 table 中轮询数据 - 用户并填充到 elasticsearch 中,我在 "index" 部分指定了索引名称,给出了一个名称,索引被创建为 "jdbc"。因此,我只能将其查询为“host/jdbc/_search 这是关于什么的?

这是创建用户索引的POST请求

http://localhost:9200/_river/users/_meta

{
"type" :
 "jdbc",

 "schedule" : "0 0-59 0-23 ? * *",

 "jdbc" : 
  {

    "driver":"com.mysql.jdbc.Driver",

    "url" : "jdbc:mysql://192.168.52.202/test_dev",

    "user" : "test_user",

    "password" : "test_pass", 

    "sql" : "select id as _id,first_name,city,email from USERS",

    "index":"users",

    "type":"user"

   }

} 

提前谢谢你:)

问题是因为我在 jdbc 块中添加了索引和类型。我看到在少数 example.After 中我更改了 json 结构,我移动了索引并在索引块中键入我得到了河流和用户索引

localhost:9200/_river/my_jdbc_river/_meta - post

{ "type" : "jdbc",

"schedule" : "0 0-59 0-23 ? * *",

"jdbc" : { "strategy":"simple",

"driver":"com.mysql.jdbc.Driver",

"url" : "jdbc:mysql://192.168.52.202/test_dev",

"user" : "test",

"password" : "test_pass", 

"sql" : "select id as _id,first_name,city,email from USERS",

 "poll":"2s"

}, "index":{ "index":"users", "type":"user", "bulk_size":500 } }