2013-06-02 98 views
2

我最近開始使用elasticsearch和couchdb,我有以下問題。我有一堆文件的沙發數據庫。我在elasticsearch上添加了一個couchDb河流索引,我希望這些文檔能被索引和搜索。但是,當我通過ES搜索任何東西時,我沒有得到任何結果。命令流程如下:彈性搜索與CouchDB河插件 - 找不到任何文件

上面的命令驗證有在CouchDB實例

curl -H "Content-Type: application/json" -X GET http://localhost:5984/my_db 

結果4個文件:

{ 
    "db_name": "my_db", 
    "doc_count": 4, 
    "doc_del_count": 0, 
    "update_seq": 4, 
    "purge_seq": 0, 
    "compact_running": false, 
    "disk_size": 16482, 
    "data_size": 646, 
    "instance_start_time": "1370204643908592", 
    "disk_format_version": 6, 
    "committed_update_seq": 4 
} 

_changes輸出:

curl -H "Content-Type: application/json" -X GET http://localhost:5984/my_db/_changes 
{ 
    "results": [ 
    { 
     "seq": 1, 
     "id": "1", 
     "changes": [ 
     { 
      "rev": "1-40d928a959dd52d183ab7c413fabca92" 
     } 
     ] 
    }, 
    { 
     "seq": 2, 
     "id": "2", 
     "changes": [ 
     { 
      "rev": "1-42212757a56b240f5205266b1969e890" 
     } 
     ] 
    }, 
    { 
     "seq": 3, 
     "id": "3", 
     "changes": [ 
     { 
      "rev": "1-f59c2ae7acacb68d9414be05d56ed33a" 
     } 
     ] 
    }, 
    { 
     "seq": 4, 
     "id": "4", 
     "changes": [ 
     { 
      "rev": "1-e86cf1c287c16906e81d901365b9bf98" 
     } 
     ] 
    } 
    ], 
    "last_seq": 4 
} 

現在,我在ES下創建我的索引。

curl -XPUT 'http://localhost:9200/_river/my_db/_meta' -d '{ 
    "type": "couchdb", 
    "couchdb": { 
    "host": "localhost", 
    "port": 5984, 
    "db": "my_db", 
    "filter": null 
    } 
}' 

{ 
    "ok": true, 
    "_index": "_river", 
    "_type": "my_db", 
    "_id": "_meta", 
    "_version": 1 
} 

但我沒有得到任何回報。

curl -XGET "http://localhost:9200/my_db/my_db/_search?pretty=true" 
{ 
    "took" : 2, 
    "timed_out" : false, 
    "_shards" : { 
    "total" : 5, 
    "successful" : 5, 
    "failed" : 0 
    }, 
    "hits" : { 
    "total" : 0, 
    "max_score" : null, 
    "hits" : [] 
    } 
} 

有什麼我失蹤了嗎?

+0

你有看看elasticsearch日誌文件嗎? – javanna

+0

Yeap - 日誌文件並沒有太多的說... – Yannis

+0

我有同樣的問題。你找到解決方案嗎? –

回答

0

您錯過了河流元數據中的ElasticSearch索引設置。從here

{ 
    "type" : "couchdb", 
    "couchdb" : { 
     "host" : "localhost", 
     "port" : 5984, 
     "db" : "my_db", 
     "filter" : null 
    }, 
    "index" : { 
     "index" : "my_db", 
     "type" : "my_db", 
     "bulk_size" : "100", 
     "bulk_timeout" : "10ms" 
    } 
} 

我還沒有看到任何文件,暗示「索引」成員可以推斷。