You are here

public function SearchApiElasticsearchBackend::ping in Elasticsearch Connector 8

Ping the Elasticsearch server to tell whether it can be accessed.

1 call to SearchApiElasticsearchBackend::ping()
SearchApiElasticsearchBackend::viewSettings in src/Plugin/search_api/backend/SearchApiElasticsearchBackend.php
Overrides viewSettings().

File

src/Plugin/search_api/backend/SearchApiElasticsearchBackend.php, line 281
Contains the SearchApiElasticsearchBackend object.

Class

SearchApiElasticsearchBackend
Plugin annotation @SearchApiBackend( id = "elasticsearch", label = @Translation("Elasticsearch"), description = @Translation("Index items using an Elasticsearch server.") )

Namespace

Drupal\elasticsearch_connector\Plugin\search_api\backend

Code

public function ping() {
  $this
    ->connect();
  try {
    if ($this->clusterEntity
      ->checkClusterStatus()) {
      return TRUE;
    }
  } catch (\Exception $e) {
    throw $e;
  }
  return FALSE;
}