wuyunfeng commented on code in PR #11547:
URL: https://github.com/apache/doris/pull/11547#discussion_r939990635
##########
fe/fe-core/src/main/java/org/apache/doris/external/elasticsearch/EsRestClient.java:
##########
@@ -158,6 +162,38 @@ public List<String> getIndexes() {
return ret;
}
+ /**
+ * Get all aliases.
+ **/
+ public Map<String, List<String>> getAliases() {
+ String res = execute("_aliases");
+ Map<String, List<String>> ret = new HashMap<>();
+ JsonNode root = JsonUtil.readTree(res);
+ if (root == null) {
+ return ret;
+ }
+ Iterator<Map.Entry<String, JsonNode>> elements = root.fields();
+ while (elements.hasNext()) {
+ Map.Entry<String, JsonNode> element = elements.next();
+ JsonNode aliases = element.getValue().get("aliases");
+ Iterator<String> aliasNames = aliases.fieldNames();
+ if (aliasNames.hasNext()) {
+ ret.put(element.getKey(), ImmutableList.copyOf(aliasNames));
+ }
+ }
+ return ret;
+ }
+
+ /**
+ * Returns the merge of index and alias
+ **/
+ public List<String> listTable() {
+ List<String> indexes =
getIndices().stream().distinct().collect(Collectors.toList());
Review Comment:
```suggestion
List<String> indices =
getIndices().stream().distinct().collect(Collectors.toList());
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]