protected function flush()
{
$indexName = $this->getIndexName();
if ($this->indices()->exists(['index' => $indexName])) {
$this->indices()->delete(['index' => $indexName]);
}
$this->indices()->create(['index' => $indexName, 'body' => ['settings' => Config::load('settings'), 'mappings' => Config::load('mappings')]]);
}