diff --git a/test/yaml-rest-runner/src/main/java/org/elasticsearch/test/rest/yaml/ESClientYamlSuiteTestCase.java b/test/yaml-rest-runner/src/main/java/org/elasticsearch/test/rest/yaml/ESClientYamlSuiteTestCase.java index da6786c8341cc..630ee9883ff83 100644 --- a/test/yaml-rest-runner/src/main/java/org/elasticsearch/test/rest/yaml/ESClientYamlSuiteTestCase.java +++ b/test/yaml-rest-runner/src/main/java/org/elasticsearch/test/rest/yaml/ESClientYamlSuiteTestCase.java @@ -484,27 +484,19 @@ public void test() throws IOException { ); final Settings globalTemplateSettings = getGlobalTemplateSettings(testCandidate.getTestSection().getSkipSection().getFeatures()); - if (globalTemplateSettings.isEmpty() == false) { - boolean useComponentTemplate = ESRestTestCase.has(ProductFeature.LEGACY_TEMPLATES) == false; + if (globalTemplateSettings.isEmpty() == false && ESRestTestCase.has(ProductFeature.LEGACY_TEMPLATES)) { final XContentBuilder template = jsonBuilder(); template.startObject(); { template.array("index_patterns", "*"); - if (useComponentTemplate) { - template.field("priority", 4); // relatively low priority, but hopefully uncommon enough not to conflict - template.startObject("template"); - } template.startObject("settings"); globalTemplateSettings.toXContent(template, ToXContent.EMPTY_PARAMS); template.endObject(); - if (useComponentTemplate) { - template.endObject(); - } } template.endObject(); - final Request request = new Request("PUT", useComponentTemplate ? "/_index_template/global" : "/_template/global"); + final Request request = new Request("PUT", "/_template/global"); request.setJsonEntity(Strings.toString(template)); // Because not all case have transitioned to a composable template, it's possible that // this can overlap an installed composable template since this is a global (*) @@ -512,9 +504,7 @@ public void test() throws IOException { // to be permissive in this case. This can be removed once all tests use composable // templates instead of legacy templates RequestOptions.Builder builder = RequestOptions.DEFAULT.toBuilder(); - if (useComponentTemplate == false) { - builder.setWarningsHandler(WarningsHandler.PERMISSIVE); - } + builder.setWarningsHandler(WarningsHandler.PERMISSIVE); request.setOptions(builder.build()); adminClient().performRequest(request); }