2011-09-17 55 views

回答

0

這不是真正的答案你」重新尋找。我研究過構建這個mongo河,但是我發現它有一些討論,它有一些內存泄漏,我不想擺弄Java代碼。我使用批量API編寫了自己的mongo-> ES導入器。

這是一項正在進行的工作,請隨時投稿! :)

https://github.com/orenmazor/elastic-search-loves-mongo

0

是的,有一個新的MongoDB河在GitHub上:

https://github.com/richardwilly98/elasticsearch-river-mongodb

對於更多解釋您可以按照以下步驟操作:

STEP.1: -Install

ES_HOME/bin/plugin -install elasticsearch/elasticsearch-mapper-attachments/1.4.0 
ES_HOME/bin/plugin -install richardwilly98/elasticsearch-river-mongodb/1.4.0 

Step.2:-Restart Elasticsearch

ES_HOME/bin/service/elasticsearch restart 

STEP.3開始: -Enable副本集MongoDB中

mongod.conf &添加行

replSet=rs0 

保存&退出

重啓mongod的

Step.4: - 告訴通過在終端發出以下命令elasticsearch索引「人」集合testmongo數據庫

curl -XPUT 'http://localhost:9200/_river/mongodb/_meta' -d '{ 
    "type": "mongodb", 
    "mongodb": { 
     "db": "testmongo", 
     "collection": "person" 
    }, 
    "index": { 
     "name": "mongoindex", 
     "type": "person" 
    } 
}' 

一步。5:通過蒙戈終端-add一些數據到mongodb的

use testmongo 
var p = {firstName: "John", lastName: "Doe"} 
db.person.save(p) 

Step.6: - 使用該命令來搜索數據

curl -XGET 'http://localhost:9200/mongoindex/_search?q=firstName:John' 

注:

DELETE /_river 

DELETE/_mongoindex 

再次運行此命令,

curl -XPUT 'http://localhost:9200/_river/mongodb/_meta' -d '{ 
    "type": "mongodb", 
    "mongodb": { 
     "db": "testmongo", 
     "collection": "person" 
    }, 
    "index": { 
     "name": "mongoindex", 
     "type": "person" 
    } 
}' 

Step.7: - 見HQ插件

mongoindex,你會得到你的數據。