You are here

public static function Cluster::getClientInstance in Elasticsearch Connector 8

Get the Elasticsearch client.

Parameters

object $cluster: The cluster object.

Return value

object The Elasticsearch object.

4 calls to Cluster::getClientInstance()
Cluster::checkClusterStatus in src/Entity/Cluster.php
Check if the cluster status is OK.
Cluster::getClientById in src/Entity/Cluster.php
Return the cluster object based on Cluster ID.
Cluster::getClusterInfo in src/Entity/Cluster.php
Return cluster info.
SearchApiElasticsearchBackend::connect in src/Plugin/search_api/backend/SearchApiElasticsearchBackend.php
Creates a connection to the Elasticsearch server as configured in $this->configuration.

File

src/Entity/Cluster.php, line 138
Contains \Drupal\elasticsearch_connector\Entity\Cluster.

Class

Cluster
Defines the search server configuration entity.

Namespace

Drupal\elasticsearch_connector\Entity

Code

public static function getClientInstance($cluster) {
  $hosts = array(
    array(
      'url' => $cluster->url,
      'options' => $cluster->options,
    ),
  );
  $client = call_user_func($cluster->connector . '::getInstance', $hosts);
  return $client;
}