@@ -527,7 +527,7 @@ public void testStartDatafeed() throws Exception {
527527
528528 // Set up the index and docs
529529 CreateIndexRequest createIndexRequest = new CreateIndexRequest (indexName );
530- createIndexRequest .mapping ("doc " , "timestamp" , "type=date" , "total" , "type=long" );
530+ createIndexRequest .mapping ("_doc " , "timestamp" , "type=date" , "total" , "type=long" );
531531 highLevelClient ().indices ().create (createIndexRequest , RequestOptions .DEFAULT );
532532 BulkRequest bulk = new BulkRequest ();
533533 bulk .setRefreshPolicy (WriteRequest .RefreshPolicy .IMMEDIATE );
@@ -538,7 +538,7 @@ public void testStartDatafeed() throws Exception {
538538 while (pastCopy < now ) {
539539 IndexRequest doc = new IndexRequest ();
540540 doc .index (indexName );
541- doc .type ("doc " );
541+ doc .type ("_doc " );
542542 doc .id ("id" + i );
543543 doc .source ("{\" total\" :" +randomInt (1000 ) + ",\" timestamp\" :" + pastCopy +"}" , XContentType .JSON );
544544 bulk .add (doc );
@@ -558,7 +558,7 @@ public void testStartDatafeed() throws Exception {
558558 DatafeedConfig datafeed = DatafeedConfig .builder (datafeedId , jobId )
559559 .setIndices (indexName )
560560 .setQueryDelay (TimeValue .timeValueSeconds (1 ))
561- .setTypes (Arrays .asList ("doc " ))
561+ .setTypes (Arrays .asList ("_doc " ))
562562 .setFrequency (TimeValue .timeValueSeconds (1 )).build ();
563563 machineLearningClient .putDatafeed (new PutDatafeedRequest (datafeed ), RequestOptions .DEFAULT );
564564
@@ -603,7 +603,7 @@ public void testStopDatafeed() throws Exception {
603603
604604 // Set up the index
605605 CreateIndexRequest createIndexRequest = new CreateIndexRequest (indexName );
606- createIndexRequest .mapping ("doc " , "timestamp" , "type=date" , "total" , "type=long" );
606+ createIndexRequest .mapping ("_doc " , "timestamp" , "type=date" , "total" , "type=long" );
607607 highLevelClient ().indices ().create (createIndexRequest , RequestOptions .DEFAULT );
608608
609609 // create the job and the datafeed
@@ -667,7 +667,7 @@ public void testGetDatafeedStats() throws Exception {
667667
668668 // Set up the index
669669 CreateIndexRequest createIndexRequest = new CreateIndexRequest (indexName );
670- createIndexRequest .mapping ("doc " , "timestamp" , "type=date" , "total" , "type=long" );
670+ createIndexRequest .mapping ("_doc " , "timestamp" , "type=date" , "total" , "type=long" );
671671 highLevelClient ().indices ().create (createIndexRequest , RequestOptions .DEFAULT );
672672
673673 // create the job and the datafeed
@@ -736,7 +736,7 @@ public void testPreviewDatafeed() throws Exception {
736736
737737 // Set up the index and docs
738738 CreateIndexRequest createIndexRequest = new CreateIndexRequest (indexName );
739- createIndexRequest .mapping ("doc " , "timestamp" , "type=date" , "total" , "type=long" );
739+ createIndexRequest .mapping ("_doc " , "timestamp" , "type=date" , "total" , "type=long" );
740740 highLevelClient ().indices ().create (createIndexRequest , RequestOptions .DEFAULT );
741741 BulkRequest bulk = new BulkRequest ();
742742 bulk .setRefreshPolicy (WriteRequest .RefreshPolicy .IMMEDIATE );
@@ -748,7 +748,7 @@ public void testPreviewDatafeed() throws Exception {
748748 Integer total = randomInt (1000 );
749749 IndexRequest doc = new IndexRequest ();
750750 doc .index (indexName );
751- doc .type ("doc " );
751+ doc .type ("_doc " );
752752 doc .id ("id" + i );
753753 doc .source ("{\" total\" :" + total + ",\" timestamp\" :" + thePast +"}" , XContentType .JSON );
754754 bulk .add (doc );
@@ -768,7 +768,7 @@ public void testPreviewDatafeed() throws Exception {
768768 DatafeedConfig datafeed = DatafeedConfig .builder (datafeedId , jobId )
769769 .setIndices (indexName )
770770 .setQueryDelay (TimeValue .timeValueSeconds (1 ))
771- .setTypes (Collections .singletonList ("doc " ))
771+ .setTypes (Collections .singletonList ("_doc " ))
772772 .setFrequency (TimeValue .timeValueSeconds (1 )).build ();
773773 machineLearningClient .putDatafeed (new PutDatafeedRequest (datafeed ), RequestOptions .DEFAULT );
774774
@@ -795,7 +795,7 @@ private String createExpiredData(String jobId) throws Exception {
795795 String indexId = jobId + "-data" ;
796796 // Set up the index and docs
797797 CreateIndexRequest createIndexRequest = new CreateIndexRequest (indexId );
798- createIndexRequest .mapping ("doc " , "timestamp" , "type=date,format=epoch_millis" , "total" , "type=long" );
798+ createIndexRequest .mapping ("_doc " , "timestamp" , "type=date,format=epoch_millis" , "total" , "type=long" );
799799 highLevelClient ().indices ().create (createIndexRequest , RequestOptions .DEFAULT );
800800 BulkRequest bulk = new BulkRequest ();
801801 bulk .setRefreshPolicy (WriteRequest .RefreshPolicy .IMMEDIATE );
@@ -809,7 +809,7 @@ private String createExpiredData(String jobId) throws Exception {
809809 long timestamp = nowMillis - TimeValue .timeValueHours (totalBuckets - bucket ).getMillis ();
810810 int bucketRate = bucket == anomalousBucket ? anomalousRate : normalRate ;
811811 for (int point = 0 ; point < bucketRate ; point ++) {
812- IndexRequest indexRequest = new IndexRequest (indexId , "doc " );
812+ IndexRequest indexRequest = new IndexRequest (indexId , "_doc " );
813813 indexRequest .source (XContentType .JSON , "timestamp" , timestamp , "total" , randomInt (1000 ));
814814 bulk .add (indexRequest );
815815 }
@@ -819,7 +819,7 @@ private String createExpiredData(String jobId) throws Exception {
819819 {
820820 // Index a randomly named unused state document
821821 String docId = "non_existing_job_" + randomFrom ("model_state_1234567#1" , "quantiles" , "categorizer_state#1" );
822- IndexRequest indexRequest = new IndexRequest (".ml-state" , "doc " , docId );
822+ IndexRequest indexRequest = new IndexRequest (".ml-state" , "_doc " , docId );
823823 indexRequest .source (Collections .emptyMap (), XContentType .JSON );
824824 indexRequest .setRefreshPolicy (WriteRequest .RefreshPolicy .IMMEDIATE );
825825 highLevelClient ().index (indexRequest , RequestOptions .DEFAULT );
@@ -1388,7 +1388,7 @@ private void updateModelSnapshotTimestamp(String jobId, String timestamp) throws
13881388 String documentId = jobId + "_model_snapshot_" + snapshotId ;
13891389
13901390 String snapshotUpdate = "{ \" timestamp\" : " + timestamp + "}" ;
1391- UpdateRequest updateSnapshotRequest = new UpdateRequest (".ml-anomalies-" + jobId , "doc " , documentId );
1391+ UpdateRequest updateSnapshotRequest = new UpdateRequest (".ml-anomalies-" + jobId , "_doc " , documentId );
13921392 updateSnapshotRequest .doc (snapshotUpdate .getBytes (StandardCharsets .UTF_8 ), XContentType .JSON );
13931393 highLevelClient ().update (updateSnapshotRequest , RequestOptions .DEFAULT );
13941394
@@ -1403,7 +1403,7 @@ private String createAndPutDatafeed(String jobId, String indexName) throws IOExc
14031403 DatafeedConfig datafeed = DatafeedConfig .builder (datafeedId , jobId )
14041404 .setIndices (indexName )
14051405 .setQueryDelay (TimeValue .timeValueSeconds (1 ))
1406- .setTypes (Arrays .asList ("doc " ))
1406+ .setTypes (Arrays .asList ("_doc " ))
14071407 .setFrequency (TimeValue .timeValueSeconds (1 )).build ();
14081408 highLevelClient ().machineLearning ().putDatafeed (new PutDatafeedRequest (datafeed ), RequestOptions .DEFAULT );
14091409 return datafeedId ;
@@ -1414,7 +1414,7 @@ public void createModelSnapshot(String jobId, String snapshotId) throws IOExcept
14141414 Job job = MachineLearningIT .buildJob (jobId );
14151415 highLevelClient ().machineLearning ().putJob (new PutJobRequest (job ), RequestOptions .DEFAULT );
14161416
1417- IndexRequest indexRequest = new IndexRequest (".ml-anomalies-shared" , "doc " , documentId );
1417+ IndexRequest indexRequest = new IndexRequest (".ml-anomalies-shared" , "_doc " , documentId );
14181418 indexRequest .setRefreshPolicy (WriteRequest .RefreshPolicy .IMMEDIATE );
14191419 indexRequest .source ("{\" job_id\" :\" " + jobId + "\" , \" timestamp\" :1541587919000, " +
14201420 "\" description\" :\" State persisted due to job close at 2018-11-07T10:51:59+0000\" , " +
@@ -1434,7 +1434,7 @@ public void createModelSnapshots(String jobId, List<String> snapshotIds) throws
14341434
14351435 for (String snapshotId : snapshotIds ) {
14361436 String documentId = jobId + "_model_snapshot_" + snapshotId ;
1437- IndexRequest indexRequest = new IndexRequest (".ml-anomalies-shared" , "doc " , documentId );
1437+ IndexRequest indexRequest = new IndexRequest (".ml-anomalies-shared" , "_doc " , documentId );
14381438 indexRequest .setRefreshPolicy (WriteRequest .RefreshPolicy .IMMEDIATE );
14391439 indexRequest .source ("{\" job_id\" :\" " + jobId + "\" , \" timestamp\" :1541587919000, " +
14401440 "\" description\" :\" State persisted due to job close at 2018-11-07T10:51:59+0000\" , " +
0 commit comments