alex-salt / yii2-elasticsearch
为 Yii 框架提供 Elasticsearch 集成和 ActiveRecord
2.1.2
2018-08-20 09:14 UTC
Requires
- ext-curl: *
- yiisoft/yii2: ~2.0.13
Replaces
This package is not auto-updated.
Last update: 2024-09-11 11:56:12 UTC
README
此扩展为 Elasticsearch 提供了 Yii 框架 2.0 的集成。它包括基本的查询/搜索支持,并实现了 ActiveRecord
模式,允许您将活动记录存储在 Elasticsearch 中。
有关许可信息,请参阅 LICENSE 文件。
文档位于 docs/guide/README.md。
要求
此扩展适用于 Elasticsearch 版本 1.0 到 4.x。目前不支持 Elasticsearch 5.0。
安装
安装此扩展的首选方法是使用 composer。
运行以下命令:
php composer.phar require --prefer-dist yiisoft/yii2-elasticsearch
或
"yiisoft/yii2-elasticsearch": "~2.0.0"
将以下内容添加到您的 composer.json 文件的 require 部分中。
配置
要使用此扩展,您必须配置应用程序配置中的 Connection 类
return [ //.... 'components' => [ 'elasticsearch' => [ 'class' => 'yii\elasticsearch\Connection', 'nodes' => [ ['http_address' => '127.0.0.1:9200'], // configure more hosts if you have a cluster ], ], ] ];