Skip to content

Commit d477aa1

Browse files
authored
Data Streams: fix bwc test (#59528) (#59534)
(cherry picked from commit ed1a5c0) Signed-off-by: Andrei Dan <[email protected]>
1 parent b357c1b commit d477aa1

File tree

1 file changed

+4
-19
lines changed

1 file changed

+4
-19
lines changed

x-pack/qa/full-cluster-restart/src/test/java/org/elasticsearch/xpack/restart/FullClusterRestartIT.java

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,12 @@
1414
import org.elasticsearch.client.ResponseException;
1515
import org.elasticsearch.client.RestClient;
1616
import org.elasticsearch.cluster.metadata.DataStream;
17-
import org.elasticsearch.cluster.metadata.Template;
1817
import org.elasticsearch.common.Strings;
19-
import org.elasticsearch.common.compress.CompressedXContent;
2018
import org.elasticsearch.common.settings.Settings;
2119
import org.elasticsearch.common.util.concurrent.ThreadContext;
2220
import org.elasticsearch.common.xcontent.DeprecationHandler;
2321
import org.elasticsearch.common.xcontent.NamedXContentRegistry;
2422
import org.elasticsearch.common.xcontent.ObjectPath;
25-
import org.elasticsearch.common.xcontent.ToXContent;
2623
import org.elasticsearch.common.xcontent.XContentBuilder;
2724
import org.elasticsearch.common.xcontent.XContentParser;
2825
import org.elasticsearch.common.xcontent.XContentType;
@@ -55,7 +52,6 @@
5552

5653
import static org.elasticsearch.common.unit.TimeValue.timeValueSeconds;
5754
import static org.elasticsearch.rest.action.search.RestSearchAction.TOTAL_HITS_AS_INT_PARAM;
58-
import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder;
5955
import static org.elasticsearch.upgrades.FullClusterRestartIT.assertNumHits;
6056
import static org.hamcrest.Matchers.anyOf;
6157
import static org.hamcrest.Matchers.containsInAnyOrder;
@@ -877,15 +873,7 @@ public void testFrozenIndexAfterRestarted() throws Exception {
877873
public void testDataStreams() throws Exception {
878874
assumeTrue("no data streams in versions before " + Version.V_7_9_0, getOldClusterVersion().onOrAfter(Version.V_7_9_0));
879875
if (isRunningAgainstOldCluster()) {
880-
String mapping = "{\n" +
881-
" \"properties\": {\n" +
882-
" \"@timestamp\": {\n" +
883-
" \"type\": \"date\"\n" +
884-
" }\n" +
885-
" }\n" +
886-
" }";
887-
Template template = new Template(null, new CompressedXContent(mapping), null);
888-
createComposableTemplate(client(), "dst", "ds", template);
876+
createComposableTemplate(client(), "dst", "ds");
889877

890878
Request indexRequest = new Request("POST", "/ds/_doc/1?op_type=create&refresh");
891879
XContentBuilder builder = JsonXContent.contentBuilder().startObject()
@@ -909,16 +897,13 @@ public void testDataStreams() throws Exception {
909897
assertNumHits("ds", 1, 1);
910898
}
911899

912-
private static void createComposableTemplate(RestClient client, String templateName, String indexPattern, Template template)
900+
private static void createComposableTemplate(RestClient client, String templateName, String indexPattern)
913901
throws IOException {
914-
XContentBuilder builder = jsonBuilder();
915-
template.toXContent(builder, ToXContent.EMPTY_PARAMS);
916902
StringEntity templateJSON = new StringEntity(
917903
String.format(Locale.ROOT, "{\n" +
918904
" \"index_patterns\": \"%s\",\n" +
919-
" \"data_stream\": { \"timestamp_field\": \"@timestamp\" },\n" +
920-
" \"template\": %s\n" +
921-
"}", indexPattern, Strings.toString(builder)),
905+
" \"data_stream\": {}\n" +
906+
"}", indexPattern),
922907
ContentType.APPLICATION_JSON);
923908
Request createIndexTemplateRequest = new Request("PUT", "_index_template/" + templateName);
924909
createIndexTemplateRequest.setEntity(templateJSON);

0 commit comments

Comments
 (0)