guandeng/elasticsearch
Composer 安装命令:
composer require guandeng/elasticsearch
包简介
A component for elasticsearch
README 文档
README
A component for elasticsearch
Installation
composer require guandeng/elasticsearch
Publish configure
php bin/hyperf.php vendor:publish guandeng/elasticsearch
Usage
Index
- Create
namespace App\Indices; use Guandeng\Elasticsearch\Index\AbstractIndex; class Test extends AbstractIndex { protected $index = 'test'; }
- Create by command
php bin/hyperf.php gen:index test
- Query
use App\Indices\Test; Test::query()->where(...)->search();
- UpdateByQuery
use App\Indices\Test; Test::query()->where(...)->script(['source' => 'ctx.source.xxx = value'])->updateByQuery();
- Count
use App\Indices\Test; Test::query()->where(...)->count();
Migrate
- Index
namespace App\Indices; use Guandeng\Elasticsearch\Index\AbstractIndex; class Test extends AbstractIndex { protected $index = 'test'; protected $type = '_doc'; protected $settings = [ // your settings ]; protected $properties = [ // your properties ]; public function getMigration(): Closure { return function ($index) { // migrate data }; } }
- Run migrate
php bin/hyperf.php elasticsearch:migrate "App\\Indices\\Test" [--migrate] [--update] [--recreate]
ClientProxy
namespace App\Proxy; use Guandeng\Elasticsearch\ClientProxy; class FooClient extends ClientProxy { protected $poolName = 'foo'; }
统计信息
- 总下载量: 821
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-12-01