You are here

protected function SearchApiElasticsearchConnector::getClusterVersion in Elasticsearch Connector 7.2

Same name and namespace in other branches
  1. 7.5 modules/elasticsearch_connector_search_api/service.inc \SearchApiElasticsearchConnector::getClusterVersion()
  2. 7 modules/elasticsearch_connector_search_api/service.inc \SearchApiElasticsearchConnector::getClusterVersion()

Get the Elasticsearch server version.

Return value

string

4 calls to SearchApiElasticsearchConnector::getClusterVersion()
SearchApiElasticsearchConnector::deleteItems in modules/elasticsearch_connector_search_api/service.inc
Overrides deleteItems().
SearchApiElasticsearchConnector::handleMLTSearch in modules/elasticsearch_connector_search_api/service.inc
Handle the "More like this" functionality if it is required.
SearchApiElasticsearchConnector::removeIndex in modules/elasticsearch_connector_search_api/service.inc
Overrides removeIndex().
SearchApiElasticsearchConnector::versionIs2x in modules/elasticsearch_connector_search_api/service.inc

File

modules/elasticsearch_connector_search_api/service.inc, line 1184
Provides a Elasticsearch-based service class for the Search API using Elasticsearch Connector module.

Class

SearchApiElasticsearchConnector
Search service class.

Code

protected function getClusterVersion() {
  static $version;
  if (!isset($version)) {
    try {
      $info = $this->elasticsearchClient
        ->info();
      $version = $info['version']['number'];
    } catch (Exception $e) {
      watchdog('Elasticsearch Search API', check_plain($e
        ->getMessage()), array(), WATCHDOG_ERROR);
    }
  }
  return $version;
}