Wallmander\ElasticsearchIndexer\Model\Indexer::flush PHP Method

flush() protected method

Delete existing index, create new index and add mappings.
protected flush ( )
    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')]]);
    }