1414import org .elasticsearch .client .ResponseException ;
1515import org .elasticsearch .client .RestClient ;
1616import org .elasticsearch .cluster .metadata .DataStream ;
17- import org .elasticsearch .cluster .metadata .Template ;
1817import org .elasticsearch .common .Strings ;
19- import org .elasticsearch .common .compress .CompressedXContent ;
2018import org .elasticsearch .common .settings .Settings ;
2119import org .elasticsearch .common .util .concurrent .ThreadContext ;
2220import org .elasticsearch .common .xcontent .DeprecationHandler ;
2321import org .elasticsearch .common .xcontent .NamedXContentRegistry ;
2422import org .elasticsearch .common .xcontent .ObjectPath ;
25- import org .elasticsearch .common .xcontent .ToXContent ;
2623import org .elasticsearch .common .xcontent .XContentBuilder ;
2724import org .elasticsearch .common .xcontent .XContentParser ;
2825import org .elasticsearch .common .xcontent .XContentType ;
5552
5653import static org .elasticsearch .common .unit .TimeValue .timeValueSeconds ;
5754import static org .elasticsearch .rest .action .search .RestSearchAction .TOTAL_HITS_AS_INT_PARAM ;
58- import static org .elasticsearch .common .xcontent .XContentFactory .jsonBuilder ;
5955import static org .elasticsearch .upgrades .FullClusterRestartIT .assertNumHits ;
6056import static org .hamcrest .Matchers .anyOf ;
6157import 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