You are here

function elasticsearch_watchdog_create_alias in Elasticsearch Connector 7

Same name and namespace in other branches
  1. 7.2 modules/elasticsearch_watchdog/elasticsearch_watchdog.admin.inc \elasticsearch_watchdog_create_alias()

Creates alias to the provided index.

Parameters

stdClass $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 elasticsearch_watchdog_create_alias()
elasticsearch_watchdog_settings_validate in modules/elasticsearch_watchdog/elasticsearch_watchdog.admin.inc
Validate the setting form submission.

File

modules/elasticsearch_watchdog/elasticsearch_watchdog.admin.inc, line 205
Created on Jan 06, 2014

Code

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