public function indexAll()
{
$deleteParams = ['index' => $this->config->get('index', 'phosphorum')];
try {
$this->client->indices()->delete($deleteParams);
} catch (Missing404Exception $e) {
$this->logger->info('The index does not exist yet. Skip deleting...');
} catch (\Exception $e) {
$this->logger->error("Indexer: {$e->getMessage()}. {$e->getFile()}:{$e->getLine()}");
}
foreach (Posts::find('deleted != ' . Posts::IS_DELETED) as $post) {
$this->doIndex($post);
}
}