0

I am trying to poll the data from database table - User and populate in elasticsearch, I specify the index name in the "index" section giving a name, the index is being created as "jdbc". Thus I can only query it as "host/jdbc/_search what is this about ?

This is the POST request for creating users index

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"

   }

} 

elasticsearch-plugin-head

enter image description here

user type Thank you in advance :)

Eva Tomovska
  • 105
  • 2
  • 9
  • You'll have to specify the index name and type within the river json e.g "index":"user", "type":"student". I'm not sure I understand the rest of the question thought! – eliasah Aug 19 '15 at 11:55
  • I did that - check json structure – Eva Tomovska Aug 19 '15 at 11:59
  • after this post request I got my user data under jdbc index so I can search for user only with host/jdbc/_search . (the second picture) – Eva Tomovska Aug 19 '15 at 12:01
  • 1
    Sorry my bad. I didn't pay attention to the those line. Try to create your river using the PUT method. – eliasah Aug 19 '15 at 12:02
  • Tnx for help but I already did that , I got the same structure.User is created as type under river. I added new picture – Eva Tomovska Aug 19 '15 at 12:12
  • When I moved index and index type in separate block I got _river and users index:) – Eva Tomovska Aug 19 '15 at 13:35
  • Cool! You can write a details answer now and accept it. – eliasah Aug 19 '15 at 13:36
  • http://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 } } – Eva Tomovska Aug 20 '15 at 07:25

1 Answers1

0

The problem was because I added index and type in the jdbc block. I saw that in few example.After I changed the json structure , I moved index and type in the index block I got river and users index

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 } }

Eva Tomovska
  • 105
  • 2
  • 9