PHP code example of clozed2u / elasticsearch-loop
1. Go to this page and download the library: Download clozed2u/elasticsearch-loop library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
clozed2u / elasticsearch-loop example snippets
use \Elasticsearch\ClientBuilder;
use \Clozed2u\Elasticsearch\ES16\Looper;
er = 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();