SomeKittens
SomeKittens

Reputation: 39522

Insert into custom index with JDBC River

I'm trying to use ElasticSearch in conjunction with MySQL. JDBC River seemed to be exactly what I wanted, but I can't get my data to insert anywhere other than jdbc/jdbc using:

curl -XPUT 'localhost:9200/_river/my_jdbc_river/_meta' -d '{
    "type" : "jdbc",
    "jdbc" : {
        "driver" : "com.mysql.jdbc.Driver",
        "url" : "jdbc:mysql://localhost:3306/the_db",
        "user" : "root",
        "password" : "hunter2",
        "sql" : "select * from hamburgers",
        "index" : "the_db",
        "type" : "hamburgers"
    }
}'

I'd expect the data to be accessible at localhost:9200/the_db/hamburgers (from what I can clean from the docs) but it's all in localhost:9200/jdbc/jdbc

Upvotes: 2

Views: 266

Answers (1)

Алексей
Алексей

Reputation: 1847

I believe that you are defining the river incorrectly. the proper way would be:

curl -XPUT 'localhost:9200/_river/my_jdbc_river/_meta' -d '{
    "type" : "jdbc",
    "jdbc" : {
        "driver" : "com.mysql.jdbc.Driver",
        "url" : "jdbc:mysql://localhost:3306/the_db",
        "user" : "root",
        "password" : "hunter2",
        "sql" : "select * from hamburgers",

    },
    "index" : {
        "index" : "the_db",
        "type" : "hamburgers"
    }
}'

Upvotes: 7

Related Questions