You are here

private function DefaultSubscriber::getIndexIdFromIndexName in Elasticsearch Connector Autocomplete 8

Calculates the Index entity id form the event.

Parameters

string $index_name: The long index name as a string.

Return value

string The id of the associated index entity.

File

src/EventSubscriber/DefaultSubscriber.php, line 140

Class

DefaultSubscriber
Class DefaultSubscriber.

Namespace

Drupal\elasticsearch_connector_autocomp\EventSubscriber

Code

private function getIndexIdFromIndexName($index_name) {
  $options = $this->connection
    ->getConnectionOptions();
  $site_database = $options['database'];
  $index_prefix = 'elasticsearch_index_' . $site_database . '_';
  $index_id = str_replace($index_prefix, '', $index_name);
  return $index_id;
}