You are here

public function SearchApiElasticsearchElastica::getElasticaIndex in Search API Elasticsearch 7

Helper function. Get an Elastica index.

7 calls to SearchApiElasticsearchElastica::getElasticaIndex()
SearchApiElasticsearchElastica::addIndex in modules/elastica/includes/SearchApiElasticsearchElastica.inc
Overrides addIndex().
SearchApiElasticsearchElastica::fieldsUpdated in modules/elastica/includes/SearchApiElasticsearchElastica.inc
Overrides fieldsUpdated().
SearchApiElasticsearchElastica::getElasticaType in modules/elastica/includes/SearchApiElasticsearchElastica.inc
Helper function. Get the corresponding Elastica type.
SearchApiElasticsearchElastica::getSettings in modules/elastica/includes/SearchApiElasticsearchElastica.inc
Get settings.
SearchApiElasticsearchElastica::removeIndex in modules/elastica/includes/SearchApiElasticsearchElastica.inc
Overrides removeIndex().

... See full list

File

modules/elastica/includes/SearchApiElasticsearchElastica.inc, line 607
Provides Elastica client for Search API Elasticsearch.

Class

SearchApiElasticsearchElastica
Search API Elasticsearch Elastica service class.

Code

public function getElasticaIndex(SearchApiIndex $index) {
  if (!empty($index) && !empty($this->elasticaClient)) {
    $index_name = $this
      ->getIndexName($index);
    try {
      $elastica_index = $this->elasticaClient
        ->getIndex($index_name);
      return $elastica_index;
    } catch (Exception $e) {
      watchdog('Elasticsearch', check_plain($e
        ->getMessage()), array(), WATCHDOG_ERROR);
      drupal_set_message(check_plain($e
        ->getMessage()), 'error');
    }
  }
  return NULL;
}