mongodb river for elasticsearch

3
有没有官方的 mongodb river 可以用于 Elasticsearch?我在 Node.js 中使用 mogoose 模块来使用 mongodb。 我在 http://www.matt-reid.co.uk/blog_post.php?id=68 看到了一个(river)。这是正确的吗?尽管说它是非官方的...

编辑:似乎 https://github.com/aparo/elasticsearch 已经内置了 mongodb 插件.. 有没有关于如何配置此插件与 mongodb 一起使用,并且 mongodb 如何将数据推送到 Elasticsearch 进行索引的文档可用?

4个回答

4


0

是的,Github上有一个新的MongoDB River:

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

如需进一步解释,请按以下步骤操作:

步骤1:-安装

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

步骤2:- 重新启动Elasticsearch

ES_HOME/bin/service/elasticsearch restart

步骤三:- 在mongodb中启用副本集

进入mongod.conf文件并添加以下行

replSet=rs0

保存并退出

重新启动mongod

步骤4:-通过在终端中输入以下命令,告诉elasticsearch在testmongo数据库中索引“person”集合

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

步骤五:通过Mongo终端向MongoDB添加一些数据

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

步骤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" 
    }
}'

第七步:查看HQ插件

mongoindex中,你可以获取你的数据。


0

这并不是你要找的答案。我曾尝试构建这个mongo river,但我发现有一些关于它存在内存泄漏的讨论,并且我不想摆弄Java代码。我使用批量API编写了自己的mongo->ES导入器。

这还在不断改进中,欢迎贡献! :)

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


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接