clozed2u/elasticsearch-loop

There is no license information available for the latest version (v0.1.3) of this package.

v0.1.3 2017-12-18 08:11 UTC

This package is not auto-updated.

Last update: 2024-04-14 01:16:12 UTC


README

Run tests

composer test

Install

composer require clozed2u/elasticsearch-loop

Usage example

use \Elasticsearch\ClientBuilder;
use \Clozed2u\Elasticsearch\ES16\Looper;

require __DIR__ . '/vendor/autoload.php';

$hosts = ['localhost:9200'];
$client_builder = new ClientBuilder();

$looper = new Looper();
$looper->createClient($hosts, $client_builder);

$looper->setSearchParams([
  'index' => 'twitter',
  'type' => 'tweet',
  'body' => [
    'query' => [
      'match_all' => []
    ]
  ]
]);

$looper->setCallback(function ($response) {
  foreach ($response['hits']['hits'] as $item) {
    echo $item['_id'], PHP_EOL;
  }
});

$looper->get();