public function DESConnector::clusterIsOk in Elasticsearch Connector 8
Check if we have a connection the cluster.
Return value
bool
File
- src/
DESConnector/ DESConnector.php, line 138 - Provides Elasticsearch Client for Drupal's Elasticsearch Connector module.
Class
- DESConnector
- Drupal Elasticsearch Interface.
Namespace
Drupal\elasticsearch_connector\DESConnectorCode
public function clusterIsOk() {
try {
$health = $this
->getCluster()
->health();
if (in_array($health['status'], array(
self::CLUSTER_STATUS_GREEN,
self::CLUSTER_STATUS_YELLOW,
))) {
$status = TRUE;
}
else {
$status = FALSE;
}
} catch (Exception $e) {
$status = FALSE;
}
return $status;
}