limingxinleo/swoft-elasticsearch

基于Swoft的Elasticsearch客户端组件

2.0.0 2019-05-24 04:35 UTC

This package is auto-updated.

Last update: 2024-11-24 17:06:33 UTC


README

Build Status

安装

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());
});