我正在研究数据的图形表示 . 该图接受JSON数据,因此我需要从couchdb获取所需的数据 . 我使用elasticsearch服务器索引couchdb,因此检索所需的数据 . 我正在使用elasticsearch河流插件将couchdb和elasticsearch服务器组合在一起 .
我创建了CouchDB数据库'testdb'并为其创建了一些测试文档 . 使用数据库设置elasticsearch . 在通过使用默认搜索条件编写CURl GET命令来测试相同内容时,我们必须使“总命中数”大于0,并且“命中”必须对搜索条件具有一些响应值 . 但我们将“总命中率”定为0和'命中':[](即null)
Procedures I followed.
1) Downloaded and installed couchdb latest version
2) Verified CouchDB is running
curl localhost:5984
I got response that starts with:
{"couchdb":"Welcome"...
3) Downloaded ElasticSearch and installed service
service.bat install curl http://127.0.0.1:9200
I got response as
{ "ok" : true, "status" : 200,.....
4) Installed the CouchDB River Plugin for ElasticSearch 1.4.2
plugin -install elasticsearch / elasticsearch-river-couchdb / 2.4.1
5) To Create the CouchDB Database and ElasticSearch Index
curl -X PUT“http://127.0.0.1:5984/testdb”
6) To Create some test documents:
curl -X PUT“http://127.0.0.1:5984/testdb/1”-d“{\”name \“:\”我的名字1 \“}”curl -X PUT“http://127.0 . 0.1:5984 / testdb / 2“-d”{\“name \”:\“我的名字2 \”}“curl -X PUT”http://127.0.0.1:5984/testdb/3“-d”{ \“name \”:\“我的名字3 \”}“curl -X PUT”http://127.0.0.1:5984/testdb/4“-d”{\“name \”:\“我的名字4 \ “}”
7) To Setup ElasticSearch with the Database
curl -X PUT“127.0.0.1:9200/_river/testdb/_meta”-d“{\”type \“:\”couchdb \“,”couchdb \“:{\”host \“:\”localhost \“,\”port \“:5984,\”db \“:\”testdb \“,\”filter \“:null},\”index \“:{\”index \“:\”testdb \“ ,\“type \”:\“testdb \”,\“bulk_size \”:\“100 \”,\“bulk_timeout \”:\“10ms \”}}“
8) To test it
卷曲“http://127.0.0.1:9200/testdb/testdb/_search?pretty=true”
on testing we should get this
{
"took" : 4,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"failed" : 0
},
"hits" : {
"total" : 4,
"max_score" : 1.0,
"hits" : [ {
"_index" : "testdb",
"_type" : "testdb",
"_id" : "4",
"_score" : 1.0, "_source" : {"_rev":"1-7e9376fc8bfa6b8c8788b0f408154584","_id":"4","name":"My Name 4"}
}, {
"_index" : "testdb",
"_type" : "testdb",
"_id" : "1",
"_score" : 1.0, "_source" : {"_rev":"1-87386bd54c821354a93cf62add449d31","_id":"1","name":"My Name"}
}, {
"_index" : "testdb",
"_type" : "testdb",
"_id" : "2",
"_score" : 1.0, "_source" : {"_rev":"1-194582c1e02d84ae36e59f568a459633","_id":"2","name":"My Name 2"}
}, {
"_index" : "testdb",
"_type" : "testdb",
"_id" : "3",
"_score" : 1.0, "_source" : {"_rev":"1-62a53c50e7df02ec22973fc802fb9fc0","_id":"3","name":"My Name 3"}
} ]
}
}
但我有这样的事情
{
"error" : "IndexMissingException[[testdb] missing]",
"status" : 404
}
1 回答
此卷曲字符串不需要额外的
testb
. 这个:应该是这样的:
您可以通过运行以下命令查看所有内容,并确保您的搜索针对您的某个索引:
curl -X GET 'localhost:9200/_cat/indices'