diff --git a/test/framework/src/main/java/org/elasticsearch/test/rest/ESRestTestCase.java b/test/framework/src/main/java/org/elasticsearch/test/rest/ESRestTestCase.java index 406b07ddbb2..7eec03befaf 100644 --- a/test/framework/src/main/java/org/elasticsearch/test/rest/ESRestTestCase.java +++ b/test/framework/src/main/java/org/elasticsearch/test/rest/ESRestTestCase.java @@ -582,11 +582,7 @@ public abstract class ESRestTestCase extends ESTestCase { adminClient().performRequest(new Request("DELETE", "_index_template/*")); adminClient().performRequest(new Request("DELETE", "_component_template/*")); } catch (ResponseException e) { - if (e.getResponse().getStatusLine().getStatusCode() == 405 || e.getResponse().getStatusLine().getStatusCode() == 500) { - // We hit a version of ES that doesn't support index templates v2 yet, so it's safe to ignore - } else { - throw e; - } + // We hit a version of ES that doesn't support index templates v2 yet, so it's safe to ignore } } else { logger.debug("Clearing all templates"); @@ -595,11 +591,7 @@ public abstract class ESRestTestCase extends ESTestCase { adminClient().performRequest(new Request("DELETE", "_index_template/*")); adminClient().performRequest(new Request("DELETE", "_component_template/*")); } catch (ResponseException e) { - if (e.getResponse().getStatusLine().getStatusCode() == 405 || e.getResponse().getStatusLine().getStatusCode() == 500) { - // We hit a version of ES that doesn't support index templates v2 yet, so it's safe to ignore - } else { - throw e; - } + // We hit a version of ES that doesn't support index templates v2 yet, so it's safe to ignore } } }