Skip to content

Commit

Permalink
Backport ESRestTestCase changes from #70094 to 7.12 branch. (#70299)
Browse files Browse the repository at this point in the history
  • Loading branch information
martijnvg committed Mar 11, 2021
1 parent 9c7fc1d commit cd719a9
Showing 1 changed file with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -619,17 +619,16 @@ private void wipeCluster() throws Exception {
}
}
} catch (Exception e) {
logger.info("ignoring exception removing all composable index templates", e);
logger.debug("ignoring exception removing all composable index templates", e);
// We hit a version of ES that doesn't support index templates v2 yet, so it's safe to ignore
}
try {
Request compReq = new Request("GET", "_component_template");
compReq.setOptions(allowTypesRemovalWarnings());
String componentTemplates = EntityUtils.toString(adminClient().performRequest(compReq).getEntity());
Map<String, Object> cTemplates = XContentHelper.convertToMap(JsonXContent.jsonXContent, componentTemplates, false);
@SuppressWarnings("unchecked")
List<String> names = ((List<Map<String, Object>>) cTemplates.get("component_templates")).stream()
.map(ct -> (String) ct.get("name"))
List<String> names = ((List<?>) cTemplates.get("component_templates")).stream()
.map(ct -> (String) ((Map<?, ?>) ct).get("name"))
.collect(Collectors.toList());
for (String componentTemplate : names) {
try {
Expand All @@ -642,7 +641,7 @@ private void wipeCluster() throws Exception {
}
}
} catch (Exception e) {
logger.info("ignoring exception removing all component templates", e);
logger.debug("ignoring exception removing all component templates", e);
// We hit a version of ES that doesn't support index templates v2 yet, so it's safe to ignore
}
Request getLegacyTemplatesRequest = new Request("GET", "_template");
Expand Down

0 comments on commit cd719a9

Please sign in to comment.