You are here

function audit_log_elastic_search_create_alias in Audit Log 7

Creates alias to the provided index.

Parameters

object $client: The ElasticSearch client object.

string $index_name: Name of the index to which the alias will be created.

string $alias_name: Name of the alias that will be created to the provided index.

1 call to audit_log_elastic_search_create_alias()
audit_log_elastic_search_settings_validate in modules/audit_log_elastic_search/audit_log_elastic_search.admin.inc
Validate the setting form submission.

File

modules/audit_log_elastic_search/audit_log_elastic_search.admin.inc, line 106
Hook implemenations for the Audit elastic search logging module.

Code

function audit_log_elastic_search_create_alias($client, $index_name, $alias_name) {
  try {
    $client
      ->indices()
      ->putAlias(array(
      'name' => $alias_name,
      'index' => $index_name,
    ));
  } catch (Exception $e) {
    throw $e;
  }
}