private Map<String, Map<Integer, List<ShardRouting>>> getIndexShardRoutings(ClusterHealthResponse clusterHealthResponse, ClusterStateResponse clusterStateResponse) { Map<String, Map<Integer, List<ShardRouting>>> indexShardRoutings = new HashMap<>(); try (XContentBuilder xContentBuilder = XContentFactory.jsonBuilder()) { for (Map.Entry<String, ClusterIndexHealth> indexHealth : clusterHealthResponse.getIndices().entrySet()) { String indexName = indexHealth.getValue().getIndex(); indexShardRoutings.put(indexName, getShardRoutings(clusterStateResponse, indexHealth)); } } catch (IOException e) { Exceptions.handle(e); } return indexShardRoutings; }
private ImmutableMap<String, IndexState> newIndicesStateCacheInstance(TransportClient client) { try { ImmutableMap.Builder<String, IndexState> cacheBuilder = ImmutableMap.<String, IndexState>builder(); GetIndexResponse getIndexResponse = client.admin().indices().prepareGetIndex().execute().actionGet(); ClusterHealthResponse clusterHealthResponse = client.admin().cluster().prepareHealth(getIndexResponse.indices()).execute().actionGet(); for (String index : clusterHealthResponse.getIndices().keySet()) { ClusterHealthStatus indexStatus = clusterHealthResponse.getIndices().get(index).getStatus(); cacheBuilder.put(index, IndexState.newIndexState(index, IndexState.IndexStatus.fromString(indexStatus.name()))); } indicesStateCacheMissing = false; return cacheBuilder.build(); } catch (Exception ex) { EsPersistLogger.warn(this, "Failed to get index state.", ex); indicesStateCacheMissing = true; return ImmutableMap.<String, IndexState>builder().build(); } } }
logger.info("Cluster nodes: {} (data {})", healthResponse.getNumberOfNodes(), healthResponse.getNumberOfDataNodes()); ClusterIndexHealth indexHealth = healthResponse.getIndices().get(indexName); logger.info("Index health: {}", indexHealth.getStatus()); logger.info(
if (healths.isTimedOut()) { logger.warn("we got a timeout when checking indices status..."); if (healths.getIndices() != null) { for (ClusterIndexHealth health : healths.getIndices().values()) { if (health.getStatus() == ClusterHealthStatus.RED) { logger.warn("index [{}] is in RED state", health.getIndex());
ClusterIndexHealth indexHealth = response.getIndices().get(indexName); IndexStats indexStats = stats.getIndices().get(indexName); IndexMetaData indexMetaData = indexMetaDatas.getIndices().get(indexName);
ClusterIndexHealth indexHealth = response.getIndices().get(indexName); IndexStats indexStats = stats.getIndices().get(indexName); IndexMetaData indexMetaData = indexMetaDatas.getIndices().get(indexName);
ClusterIndexHealth indexHealth = response.getIndices().get(indexName); IndexStats indexStats = stats.getIndices().get(indexName); IndexMetaData indexMetaData = indexMetaDatas.getIndices().get(indexName);
ClusterIndexHealth indexHealth = response.getIndices().get(indexName); IndexStats indexStats = stats.getIndices().get(indexName); IndexMetaData indexMetaData = indexMetaDatas.getIndices().get(indexName);
ClusterIndexHealth indexHealth = health.getIndices().get(index); IndexStats indexStats = stats.getIndices().get(index); IndexMetaData indexMetaData = indexMetaDatas.getIndices().get(index);