3

I am trying to integrate MYSQL in ElasticSearch On windows 7 from this link

I have completed the following steps:

1:

Download & Unzip in C Directory https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-1.3.4.zip

2:

Run this command on CMD ./bin/plugin --install jdbc --url http://xbib.org/repository/org/xbib/elasticsearch/plugin/elasticsearch-river-jdbc/1.3.4.4/elasticsearch-river-jdbc-1.3.4.4-plugin.zip

3:

Download MYSQL Connector mysql-connector-java-5.1.33.zip from MYSQL website.

Unzip and copy mysql-connector-java-5.1.33-bin.jar file.

Place it into C:\elasticsearch-1.3.4\plugins\jdbc

I have checked now there are two files in plugins directory

  • elasticsearch-river-jdbc-1.3.4.4.jar

  • mysql-connector-java-5.1.33-bin

Now I tried to execute this command on CMD and I got error

curl -XPUT 'localhost:9200/_river/jdbc-1.3.4.4-d2e33c3/_meta' -d '{
    "type" : "jdbc",
    "jdbc" : {
        "url" : "jdbc:mysql://localhost:3306/test",
        "user" : "root",
        "password" : "pass",
        "sql" : "select * from abc"
    }
}'

{
  "error": "MapperParsingException[failed to parse]; nested: JsonParseException[Unexpected character (''' (code 39)): expected a valid value (number, String, array, object, 'true', 'false' or 'null')\n at [Source: [B@3cf756; line: 1, column:2]]; ",
  "status": 400
}

curl: (6) Could not resolve host: type; Host not found

curl: (6) Could not resolve host: :; No data record of requested type

curl: (6) Could not resolve host: jdbc,jdbc; No data record of requested type

curl: (6) Could not resolve host: :; No data record of requested type

curl: (3) [globbing] unmatched brace at pos 5

curl: (6) Could not resolve host: :; No data record of requested type

curl: (6) Could not resolve host: jdbc:mysql:; No data record of requested type

curl: (6) Could not resolve host: :; No data record of requested type

curl: (6) Could not resolve host: root,password; No data record of requested typ
e
curl: (6) Could not resolve host: :; No data record of requested type

curl: (6) Could not resolve host: pass,sql; No data record of requested type

curl: (6) Could not resolve host: :; No data record of requested type

curl: (6) Could not resolve host: select * from abc; No data record of requested type

MYSQL(5.5.37) Database (test) contains just one table (abc) with two columns id(pk) and address (varchar)

I am using this jdbc-1.3.4.4-d2e33c3 name as jdbc driver. I get this name from this link.

http://localhost:9200/_nodes?settings=true&pretty=true

I have searched on it but cannot found any issue like this related to mysql integration.

My Question is anything still missing or I am doing wrong setup.?

4 Answers 4

5

On Windows curls acts differently. Try using curl -XPUT "http://127.0.0.1:9200/index/type/id" -d "{ """attribute""" : """name""" }".Try with those triple quotes

Sign up to request clarification or add additional context in comments.

1 Comment

thanks @atkawa7. i wonder why curl uses triple quotes. i also tried with \" and it worked (in windows 7 64 bit)
0

Use Sense (Beta) extension of Google Chrome. It has very nice features like auto-complete, syntax checking, syntax highlighting, keyboard shortcuts, and history.

Marvel is another option. a complete developer-free ES management console. it is included a newer version of Sense, but it's not free for production nodes and has features that this question didn't ask

Comments

0

Sure,on windows curl acts different.. Mine is windows 7 64bit os This worked for me..

curl -XPUT "http://localhost:9200/twitter/tweet/1" -d "{""user"":""Rahul A Pawar"", ""message"":""it was fun""}"

-Use double quotes for key:value.

Comments

0

And yes, if your value contains a space, remember it to escape it with backslash (\ ). And what """ means, you are escaping one double-quote with another double-quote leaving effectively two to be processed. It all boils down to escaping chars in a Windows way.

1 Comment

Correction: Instead of \ please use " above to escape space.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.