function elasticsearch_connector_get_indices_options in Elasticsearch Connector 7.5
Same name and namespace in other branches
- 8.7 elasticsearch_connector.module \elasticsearch_connector_get_indices_options()
- 8 elasticsearch_connector.module \elasticsearch_connector_get_indices_options()
- 8.2 elasticsearch_connector.module \elasticsearch_connector_get_indices_options()
- 8.5 elasticsearch_connector.module \elasticsearch_connector_get_indices_options()
- 8.6 elasticsearch_connector.module \elasticsearch_connector_get_indices_options()
- 7 elasticsearch_connector.module \elasticsearch_connector_get_indices_options()
- 7.2 elasticsearch_connector.module \elasticsearch_connector_get_indices_options()
Get the indeces based on cluster id.
Parameters
string $cluster_id:
Return value
array Indices
1 call to elasticsearch_connector_get_indices_options()
- _elasticsearch_connector_ec_index_process in ./
elasticsearch_connector.module - Build two dropdowns, one for the cluster and one for the indices.
File
- ./
elasticsearch_connector.module, line 627 - This module provide an interface to connecting to the elasticsearch cluster and implementing the official Elasticsearch library.
Code
function elasticsearch_connector_get_indices_options($cluster_id, $empty_option = FALSE) {
$result = array();
$client = elasticsearch_connector_get_client_by_id($cluster_id);
if ($client) {
$indices = $client
->indices()
->stats();
drupal_alter('elasticsearch_connector_indices', $indices);
if ($empty_option) {
$result[''] = t('Select index');
}
if (!empty($indices['indices'])) {
foreach ($indices['indices'] as $index_name => $index_info) {
// TODO: Check index status if such e.g. index closed or s.o.
$result[$index_name] = $index_name;
}
}
}
return $result;
}