limingxinleo / swoft-elasticsearch
基于Swoft的Elasticsearch客户端组件
Installs: 1 482
Dependents: 0
Suggesters: 0
Security: 0
Stars: 7
Watchers: 2
Forks: 3
Open Issues: 0
Requires
- php: >=7.0
- elasticsearch/elasticsearch: ^6.0
Requires (Dev)
- phpunit/phpunit: ^7.0
- swoft/swoole-ide-helper: dev-master
README
安装
composer require limingxinleo/swoft-elasticsearch
使用
使用方法与官方ES客户端一致
<?php use Elasticsearch\ClientBuilder; use Swoftx\Elasticsearch\CoroutineHandler; $handler = new CoroutineHandler([ 'timeout' => 2 ]); $client = ClientBuilder::create() ->setHosts(['127.0.0.1:9200']) ->setHandler($handler) ->build(); go(function() use ($client){ print_r($client->info()); });