|
26 | 26 | import org.elasticsearch.common.io.stream.StreamInput;
|
27 | 27 | import org.elasticsearch.common.io.stream.StreamOutput;
|
28 | 28 | import org.elasticsearch.common.xcontent.XContentBuilder;
|
| 29 | +import org.elasticsearch.index.Index; |
29 | 30 |
|
30 | 31 | import java.io.IOException;
|
31 | 32 | import java.util.ArrayList;
|
@@ -84,19 +85,22 @@ public Map<String, IndexStats> getIndices() {
|
84 | 85 | }
|
85 | 86 | Map<String, IndexStats> indicesStats = new HashMap<>();
|
86 | 87 |
|
87 |
| - Set<String> indices = new HashSet<>(); |
| 88 | + Set<Index> indices = new HashSet<>(); |
88 | 89 | for (ShardStats shard : shards) {
|
89 |
| - indices.add(shard.getShardRouting().getIndexName()); |
| 90 | + indices.add(shard.getShardRouting().index()); |
90 | 91 | }
|
91 | 92 |
|
92 |
| - for (String indexName : indices) { |
| 93 | + for (Index index : indices) { |
93 | 94 | List<ShardStats> shards = new ArrayList<>();
|
| 95 | + String indexName = index.getName(); |
94 | 96 | for (ShardStats shard : this.shards) {
|
95 | 97 | if (shard.getShardRouting().getIndexName().equals(indexName)) {
|
96 | 98 | shards.add(shard);
|
97 | 99 | }
|
98 | 100 | }
|
99 |
| - indicesStats.put(indexName, new IndexStats(indexName, shards.toArray(new ShardStats[shards.size()]))); |
| 101 | + indicesStats.put( |
| 102 | + indexName, new IndexStats(indexName, index.getUUID(), shards.toArray(new ShardStats[shards.size()])) |
| 103 | + ); |
100 | 104 | }
|
101 | 105 | this.indicesStats = indicesStats;
|
102 | 106 | return indicesStats;
|
@@ -169,7 +173,7 @@ protected void addCustomXContentFields(XContentBuilder builder, Params params) t
|
169 | 173 | builder.startObject(Fields.INDICES);
|
170 | 174 | for (IndexStats indexStats : getIndices().values()) {
|
171 | 175 | builder.startObject(indexStats.getIndex());
|
172 |
| - |
| 176 | + builder.field("uuid", indexStats.getUuid()); |
173 | 177 | builder.startObject("primaries");
|
174 | 178 | indexStats.getPrimaries().toXContent(builder, params);
|
175 | 179 | builder.endObject();
|
|
0 commit comments