【问题标题】:Bonsai automatic indexing盆景自动分度
【发布时间】:2015-06-15 10:03:47
【问题描述】:

我使用 MongoDb 和一个快速的 Heroku 托管应用进行存储。

我想通过Bonsai Heroku 插件使用 ElasticSearch 为一些 MongoDb 集合提供搜索功能。

但是,根据Bonsai faq,不支持 Elasticsearch River 插件。

如果我不能使用elasticsearch-river-mongodb,如何使用自定义映射在 Bonsai 上自动重新索引我的 MongoDb 集合(创建/更新/删除 MongoDb 文档时)?

【问题讨论】:

    标签: mongodb heroku express elasticsearch bonsai-elasticsearch


    【解决方案1】:

    这是盆景支持的答案:

    - You could always set up a script with a curl command to index the MongoDB collections, then use cron to run the script at regular intervals.
    - You could also use an Elasticsearch client to index collections in some cases.
    

    所以我受Elaster的启发制作了一个reindex脚本,它可以:

    • 使用node-cron 定期调用;

    • 或在事件检测后按需调用;触发我使用mongo-oplog 的事件,如下所示:

      oplog.on('insert', function (doc) {
        reindex();
      });
      

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-02-20
      • 2018-05-19
      • 2016-01-06
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多