是的,有一個新的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
,你會得到你的數據。