for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Triadev\EsMigration\Business\Migration;
use Elasticsearch\Client;
class Reindex extends AbstractMigration
{
/**
* Get validation rules
*
* @return array
*/
public function getValidationRules(): array
return [
'body' => 'required|array',
'body.source.index' => 'required|string',
'body.dest.index' => 'required|string'
];
}
* Pre check
* @param Client $esClient
* @param array $params
* @throws \Exception
public function preCheck(Client $esClient, array $params)
$indices = implode(',', [
array_get($params, 'body.source.index'),
array_get($params, 'body.dest.index')
]);
if (!$esClient->indices()->exists(['index' => $indices])) {
throw new \Exception(sprintf("Index not exist: %s", $indices));
* Start migration
public function startMigration(Client $esClient, array $params)
$esClient->reindex($params);
* Post check
public function postCheck(Client $esClient, array $params)
// TODO: Implement postCheck() method.