protected function SearchApiElasticsearchIndex::replaceIndex in Search API Elasticsearch 7.2
Helper method for replacing Elasticsearch index after making changes that cannot be applied via update.
@TODO Consider using aliases to create a new Elasticsearch Index and migrate indexed items to new Elasticsearch Index on the Elasticsearch side before deleting the old index. This will allow for zero-downtime updates.
Parameters
SearchApiIndex $index:
Index $old_index:
2 calls to SearchApiElasticsearchIndex::replaceIndex()
- SearchApiElasticsearchIndex::deleteAllItems in includes/
SearchApiElasticsearchIndex.inc - Delete all documents in an Elasticsearch index.
- SearchApiElasticsearchIndex::updateFields in includes/
SearchApiElasticsearchIndex.inc - Update fields on an Elasticsearch Index.
File
- includes/
SearchApiElasticsearchIndex.inc, line 170
Class
Code
protected function replaceIndex(SearchApiIndex $index, Index $old_index) {
$this
->delete();
$this->search_api_service
->addIndex($index);
}