@@ -48,9 +48,9 @@ public void testGlobalPipelineOnBulkRequest() throws IOException {
48
48
createFieldAddingPipleine ("xyz" , "fieldNameXYZ" , "valueXYZ" );
49
49
50
50
BulkRequest request = new BulkRequest ();
51
- request .add (new IndexRequest ("test" , "doc" , "1" )
51
+ request .add (new IndexRequest ("test" ). id ( "1" )
52
52
.source (XContentType .JSON , "field" , "bulk1" ));
53
- request .add (new IndexRequest ("test" , "doc" , "2" )
53
+ request .add (new IndexRequest ("test" ). id ( "2" )
54
54
.source (XContentType .JSON , "field" , "bulk2" ));
55
55
request .pipeline ("xyz" );
56
56
@@ -67,10 +67,10 @@ public void testPipelineOnRequestOverridesGlobalPipeline() throws IOException {
67
67
68
68
BulkRequest request = new BulkRequest ();
69
69
request .pipeline ("globalId" );
70
- request .add (new IndexRequest ("test" , "doc" , "1" )
70
+ request .add (new IndexRequest ("test" ). id ( "1" )
71
71
.source (XContentType .JSON , "field" , "bulk1" )
72
72
.setPipeline ("perIndexId" ));
73
- request .add (new IndexRequest ("test" , "doc" , "2" )
73
+ request .add (new IndexRequest ("test" ). id ( "2" )
74
74
.source (XContentType .JSON , "field" , "bulk2" )
75
75
.setPipeline ("perIndexId" ));
76
76
@@ -91,11 +91,11 @@ public void testMixPipelineOnRequestAndGlobal() throws IOException {
91
91
BulkRequest request = new BulkRequest ();
92
92
request .pipeline ("globalId" );
93
93
94
- request .add (new IndexRequest ("test" , "doc" , "1" )
94
+ request .add (new IndexRequest ("test" ). id ( "1" )
95
95
.source (XContentType .JSON , "field" , "bulk1" )
96
96
.setPipeline ("perIndexId" )); // <1>
97
97
98
- request .add (new IndexRequest ("test" , "doc" , "2" )
98
+ request .add (new IndexRequest ("test" ). id ( "2" )
99
99
.source (XContentType .JSON , "field" , "bulk2" )); // <2>
100
100
// end::bulk-request-mix-pipeline
101
101
bulk (request );
@@ -110,9 +110,9 @@ public void testMixPipelineOnRequestAndGlobal() throws IOException {
110
110
111
111
public void testGlobalIndex () throws IOException {
112
112
BulkRequest request = new BulkRequest ("global_index" , null );
113
- request .add (new IndexRequest ().type ( "doc" ). id ("1" )
113
+ request .add (new IndexRequest ().id ("1" )
114
114
.source (XContentType .JSON , "field" , "bulk1" ));
115
- request .add (new IndexRequest ().type ( "doc" ). id ("2" )
115
+ request .add (new IndexRequest ().id ("2" )
116
116
.source (XContentType .JSON , "field" , "bulk2" ));
117
117
118
118
bulk (request );
@@ -124,9 +124,9 @@ public void testGlobalIndex() throws IOException {
124
124
@ SuppressWarnings ("unchecked" )
125
125
public void testIndexGlobalAndPerRequest () throws IOException {
126
126
BulkRequest request = new BulkRequest ("global_index" , null );
127
- request .add (new IndexRequest ("local_index" , "doc" , "1" )
127
+ request .add (new IndexRequest ("local_index" ). id ( "1" )
128
128
.source (XContentType .JSON , "field" , "bulk1" ));
129
- request .add (new IndexRequest ().type ( "doc" ). id ("2" ) // will take global index
129
+ request .add (new IndexRequest ().id ("2" ) // will take global index
130
130
.source (XContentType .JSON , "field" , "bulk2" ));
131
131
132
132
bulk (request );
@@ -140,7 +140,7 @@ public void testIndexGlobalAndPerRequest() throws IOException {
140
140
}
141
141
142
142
public void testGlobalType () throws IOException {
143
- BulkRequest request = new BulkRequest (null , "global_type " );
143
+ BulkRequest request = new BulkRequest (null , "_doc " );
144
144
request .add (new IndexRequest ("index" ).id ("1" )
145
145
.source (XContentType .JSON , "field" , "bulk1" ));
146
146
request .add (new IndexRequest ("index" ).id ("2" )
@@ -149,10 +149,11 @@ public void testGlobalType() throws IOException {
149
149
bulk (request );
150
150
151
151
Iterable <SearchHit > hits = searchAll ("index" );
152
- assertThat (hits , everyItem (hasType ("global_type " )));
152
+ assertThat (hits , everyItem (hasType ("_doc " )));
153
153
}
154
154
155
155
@ SuppressWarnings ("unchecked" )
156
+ @ AwaitsFix (bugUrl = "https://github.com/elastic/elasticsearch/pull/36549" )
156
157
public void testTypeGlobalAndPerRequest () throws IOException {
157
158
BulkRequest request = new BulkRequest (null , "global_type" );
158
159
request .add (new IndexRequest ("index1" , "local_type" , "1" )
@@ -174,9 +175,9 @@ public void testTypeGlobalAndPerRequest() throws IOException {
174
175
public void testGlobalRouting () throws IOException {
175
176
createIndexWithMultipleShards ("index" );
176
177
BulkRequest request = new BulkRequest (null , null );
177
- request .add (new IndexRequest ("index" , "type" , "1" )
178
+ request .add (new IndexRequest ("index" ). id ( "1" )
178
179
.source (XContentType .JSON , "field" , "bulk1" ));
179
- request .add (new IndexRequest ("index" , "type" , "2" )
180
+ request .add (new IndexRequest ("index" ). id ( "2" )
180
181
.source (XContentType .JSON , "field" , "bulk1" ));
181
182
request .routing ("1" );
182
183
bulk (request );
@@ -192,9 +193,9 @@ public void testGlobalRouting() throws IOException {
192
193
public void testMixLocalAndGlobalRouting () throws IOException {
193
194
BulkRequest request = new BulkRequest (null , null );
194
195
request .routing ("globalRouting" );
195
- request .add (new IndexRequest ("index" , "type" , "1" )
196
+ request .add (new IndexRequest ("index" ). id ( "1" )
196
197
.source (XContentType .JSON , "field" , "bulk1" ));
197
- request .add (new IndexRequest ("index" , "type" , "2" )
198
+ request .add (new IndexRequest ("index" ). id ( "2" )
198
199
.routing ("localRouting" )
199
200
.source (XContentType .JSON , "field" , "bulk1" ));
200
201
0 commit comments