我使用 Elasticsearch 来面对JDBC驱动程序的问题。
我已经下载了必要的文件,它已安装在我的htdocs文件夹中。
这是我安装的路径
e:\xampp\htdocs\search\elasticsearch-1.7.1
我已将JDBC插件安装在同一文件夹中,路径为
e:\xampp\htdocs\search\elasticsearch-1.7.1\plugins\river-jdbc\
以上路径有两个文件
1) elasticsearch-river-jdbc-1.0.0.RC1.2.jar
2) mysql-connector-java-5.1.26-bin.jar
安装完成后,我重新启动了bin文件夹中的elasticsearch.bat。
然后我检查了以下路径中的jdbc
http://localhost:9200/_nodes?settings=true&pretty=true\
我得到了所有细节,这里是插件节点,
"plugins": [
{
"name": "river-jdbc",
"version": "NA",
"description": "JDBC River",
"jvm": true,
"site": false
}
我希望安装完成。然后我在e:\xampp\htdocs\search\elasticsearch-1.7.1\
创建了config.json文件
此文件包含以下代码
{
"type" : "jdbc",
"jdbc" :{
"strategy" : "oneshot",
"driver" : "com.mysql.jdbc.Driver",
"url" : "jdbc:mysql://localhost:9200/dbname",
"user" : "root",
"password" : "",
"sql" : "select * from tablename",
"poll" : "1h",
"scale" : 0,
"autocommit" : false,
"fetchsize" : 100,
"max_rows" : 0,
"max_retries" : 3,
"max_retries_wait" : "10s",
"locale" : "it",
"digesting" : true,
},
"index" : {
"index" : "jdbc",
"type" : "jdbc",
"bulk_size" : 100,
"max_bulk_requests" : 30,
"versioning" : false,
"acknowledge" : false
}
}
如果我正在运行以下代码
E:\Xampp\htdocs\search\elasticsearch-1.7.1>curl -XPUT "http://127.0.0.1:9200/_river/jdbcriver/_meta" -d @config.json
它显示以下错误,
{"error":"MapperParsingException[failed to parse]; nested: JsonParseException[Un
expected character ('}' (code 125)): was expecting either valid name character (
for unquoted name) or double-quote (for quoted) to start field name\n at [Source
: [B@458c9675; line: 1, column: 495]]; ","status":400}
E:\Xampp\htdocs\search\elasticsearch-1.7.1>
我的遗体有什么遗漏。如何连接表格并获得结果?