public function SearchApiElasticsearchIndex::updateFields in Search API Elasticsearch 7.2
Update fields on an Elasticsearch Index.
Return value
bool
File
- includes/
SearchApiElasticsearchIndex.inc, line 45
Class
Code
public function updateFields() {
$index = $this
->getElasticsearchIndex();
$type = $index
->getType($this->search_api_index->machine_name);
$mapping = $this
->createElasticsearchMapping($type);
try {
// First we attempt to update the mapping for scenarios where updating is
// allowed.
try {
$mapping
->send();
} catch (Exception $e) {
// If a mapping cannot be updated, then we create a new index and
// migrate data to it.
$this
->replaceIndex($this->search_api_index, $index);
}
} catch (Exception $e) {
return FALSE;
}
// We still return FALSE here because we do not change update the index
// alias until data has been moved to new index.
return FALSE;
}