Elasticsearch 的 mongodb 河

发布于 2024-12-05 01:33:31 字数 449 浏览 1 评论 0原文

有没有官方的 mongodb River 可用于 elasticsearch ?我通过 mogoose 模块在 node.js 中使用 mongodb。 我在 http://www.matt-reid.co 中看到过一个。 uk/blog_post.php?id=68

这是正确的吗?虽然它说是非官方的...

编辑: 看起来, https://github.com/aparo/elasticsearch 有内置的 mongodb 插件..有没有有关如何使用 mongodb 进行配置以及 mongodb 如何将索引数据推送到 elasticsearch 的文档?

Is there any official mongodb river available for elasticsearch ? I am using mongodb in node.js through the module mogoose.
I have seen one in http://www.matt-reid.co.uk/blog_post.php?id=68

Is this the correct one ? It says unofficial though...

Edit:
looks like, https://github.com/aparo/elasticsearch has inbuilt mongodb plugin.. Is there any doc available about how to configure this with mongodb and how mongodb pushes data for indexing to elasticsearch?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

凤舞天涯 2024-12-12 01:33:31

根据代码,您可以指定几件事,但没有单独的文档(预计有一个邮件列表讨论):

https://github.com/aparo/elasticsearch/blob/master/plugins/river/mongodb/src/main/java/org/elasticsearch/river/mongodb/MongoDBRiver.java

<一个href="https://github.com/aparo/elasticsearch/blob/master/plugins/river/mongodb/src/test/java/org/elasticsearch/river/mongodb/MongoDBRiverTest.java" rel="nofollow">https://github.com/aparo/elasticsearch/blob/master/plugins/river/mongodb/src/test/java/org/elasticsearch/river/mongodb/MongoDBRiverTest.java

荒路情人 2024-12-12 01:33:31

这并不是您真正要寻找的答案。我考虑过构建这个 mongo River,但我发现一些关于它存在内存泄漏的讨论,我不想摆弄 Java 代码。我使用批量 API 编写了自己的 mongo->ES 导入器。

这是一项正在进行中的工作,因此请随时做出贡献! :)

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

This isn't really the answer you're looking for. I looked at building this mongo river but I found some discussion on it having some memory leaks and I didn't want to fiddle with Java code. I wrote my own mongo->ES importer using the bulk API.

It's a work in progress, so feel free to contribute! :)

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

帅气称霸 2024-12-12 01:33:31

是的,github 上有一条新的 MongoDB 河流:

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

第 3 步: - 在 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" 
    }
}'

第 5 步:< /strong> - 通过 mongo 终端向 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'

NOTE:

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 中,您将获取您的数据。

Yes, There is a new MongoDB river on github:

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

For Further Explanation You can follow below steps:

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 replica sets in mongodb

go to mongod.conf & Add line

replSet=rs0

save & Exit

Restart mongod

Step.4: -Tell elasticsearch to index the “person” collection in testmongo database by issuing the following command in your terminal

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

Step.5: -add some data to the mongodb through mongo terminal

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

Step.6: -Use this command to search the data

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

NOTE:

DELETE /_river

DELETE/_mongoindex

Again run this command,

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

Step.7: -See HQ Plugin

In mongoindex, you will get your data.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文