You are here

public function SearchApiElasticsearchAbstractService::getExtraInformation in Search API Elasticsearch 7

Returns additional, service-specific information about this server.

If a service class implements this method and supports the "search_api_service_extra" option, this method will be used to add extra information to the server's "View" tab.

In the default theme implementation this data will be output in a table with two columns along with other, generic information about the server.

Return value

array An array of additional server information, with each piece of information being an associative array with the following keys:

  • label: The human-readable label for this data.
  • info: The information, as HTML.
  • status: (optional) The status associated with this information. One of "info", "ok", "warning" or "error". Defaults to "info".

Overrides SearchApiAbstractService::getExtraInformation

See also

supportsFeature()

File

includes/SearchApiElasticsearchAbstractService.inc, line 994
Provides a Elasticsearch-based service class for the Search API.

Class

SearchApiElasticsearchAbstractService
Elasticsearch service abstract class.

Code

public function getExtraInformation() {
  $info = array();
  $cluster_health = $this
    ->getClusterHealth();
  if (!empty($cluster_health)) {
    $info[] = array(
      'label' => t('Cluster Name'),
      'info' => $cluster_health['cluster_name'],
    );
    $info[] = array(
      'label' => t('Cluster Status'),
      'info' => $cluster_health['status'],
    );
    $info[] = array(
      'label' => t('Number of Nodes'),
      'info' => $cluster_health['number_of_nodes'],
    );
    $info[] = array(
      'label' => t('Number of Data Nodes'),
      'info' => $cluster_health['number_of_data_nodes'],
    );
    $info[] = array(
      'label' => t('Active Primary Shards'),
      'info' => $cluster_health['active_primary_shards'],
    );
    $info[] = array(
      'label' => t('Active Shards'),
      'info' => $cluster_health['active_shards'],
    );
    $info[] = array(
      'label' => t('Relocating Shards'),
      'info' => $cluster_health['relocating_shards'],
    );
    $info[] = array(
      'label' => t('Initializing Shards'),
      'info' => $cluster_health['initializing_shards'],
    );
    $info[] = array(
      'label' => t('Unassigned Shards'),
      'info' => $cluster_health['unassigned_shards'],
    );
  }
  return $info;
}