【问题标题】:Laravel Elasticquent : How to synchronize mysql table's data to Elasticsearch?Laravel Elasticquent:如何将 mysql 表的数据同步到 Elasticsearch?
【发布时间】:2016-10-20 02:22:53
【问题描述】:

我正在使用这个 laravel 包,"Elasticquent"(https://github.com/elasticquent/Elasticquent),

我的问题是,
如何将mysql表的数据同步到Elasticsearch?
比如mysql有一个名为“articles”的表,如果新增了一些文章,如何同步到Elasticsearch?

【问题讨论】:

    标签: php mysql laravel elasticsearch


    【解决方案1】:

    从 Laracon EU (https://m.youtube.com/watch?v=waTWeJeFp4A) 查看此演示文稿以帮助您入门。那里有一些很好的提示,尤其是用于同步新数据的模型事件。

    易于使用 Laravel 包与 elasticsearch 一起工作。更多信息在这里:https://murze.be/2015/01/using-elasticsearch-in-laravel/

    希望它能帮助您了解同步数据的过程。

    【讨论】:

      【解决方案2】:

      你可以使用 Logstash https://www.elastic.co/downloads/logstash

      但是如果及时同步很重要,并且您想使用 Elasticquent,您可以使用

      articles::addAllToIndex();

      接下来您可以编写customize查询并使用示例

      $articles = articles::where('created_at', '<', <yourFormat>)->get();
      $articles->addToIndex();
      

      在您的管理服务器作业中随时运行它 https://github.com/elasticquent/Elasticquent#indexing-documents

      【讨论】:

        猜你喜欢
        • 2016-06-07
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2016-03-21
        • 1970-01-01
        • 2017-05-16
        • 1970-01-01
        相关资源
        最近更新 更多