问题
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.?
回答1:
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
回答2:
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
回答3:
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.
回答4:
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.
来源:https://stackoverflow.com/questions/27355553/elasticsearch-error-mapperparsingexception-failed-to-parse