clozed2u / elasticsearch-loop
Installs: 3 538
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Requires
- php: >=7.0
- elasticsearch/elasticsearch: ^2.3
Requires (Dev)
- monolog/monolog: ^1.22
- phpunit/phpunit: ^6.1
This package is not auto-updated.
Last update: 2025-01-05 04:53:11 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();