You are here

protected function SearchApiElasticsearchBackend::getIndexId in Elasticsearch Connector 8.5

Same name and namespace in other branches
  1. 8.7 src/Plugin/search_api/backend/SearchApiElasticsearchBackend.php \Drupal\elasticsearch_connector\Plugin\search_api\backend\SearchApiElasticsearchBackend::getIndexId()
  2. 8 src/Plugin/search_api/backend/SearchApiElasticsearchBackend.php \Drupal\elasticsearch_connector\Plugin\search_api\backend\SearchApiElasticsearchBackend::getIndexId()
  3. 8.2 src/Plugin/search_api/backend/SearchApiElasticsearchBackend.php \Drupal\elasticsearch_connector\Plugin\search_api\backend\SearchApiElasticsearchBackend::getIndexId()
  4. 8.6 src/Plugin/search_api/backend/SearchApiElasticsearchBackend.php \Drupal\elasticsearch_connector\Plugin\search_api\backend\SearchApiElasticsearchBackend::getIndexId()

Prefixes an index ID as configured.

The resulting ID will be a concatenation of the following strings:

  • If set, the "elasticsearch.settings.index_prefix" configuration.
  • If set, the index-specific "elasticsearch.settings.index_prefix_INDEX" configuration.
  • The index's machine name.

Parameters

string $machine_name: The index's machine name.

Return value

string The prefixed machine name.

File

src/Plugin/search_api/backend/SearchApiElasticsearchBackend.php, line 776

Class

SearchApiElasticsearchBackend
Elasticsearch Search API Backend definition.

Namespace

Drupal\elasticsearch_connector\Plugin\search_api\backend

Code

protected function getIndexId($machine_name) {

  // Prepend per-index prefix.
  $id = $this->elasticsearchSettings
    ->get('index_prefix_' . $machine_name) . $machine_name;

  // Prepend environment prefix.
  $id = $this->elasticsearchSettings
    ->get('index_prefix') . $id;
  return $id;
}