56
56
import org .elasticsearch .rest .RestStatus ;
57
57
import org .elasticsearch .rest .action .document .RestBulkAction ;
58
58
import org .elasticsearch .rest .action .document .RestDeleteAction ;
59
- import org .elasticsearch .rest .action .document .RestGetAction ;
60
59
import org .elasticsearch .rest .action .document .RestIndexAction ;
61
- import org .elasticsearch .rest .action .document .RestMultiGetAction ;
62
60
import org .elasticsearch .rest .action .document .RestUpdateAction ;
63
61
import org .elasticsearch .script .Script ;
64
62
import org .elasticsearch .script .ScriptType ;
@@ -293,7 +291,6 @@ public void testGet() throws IOException {
293
291
}
294
292
GetResponse getResponse = execute (getRequest , highLevelClient ()::get , highLevelClient ()::getAsync );
295
293
assertEquals ("index" , getResponse .getIndex ());
296
- assertEquals ("_doc" , getResponse .getType ());
297
294
assertEquals ("id" , getResponse .getId ());
298
295
assertTrue (getResponse .isExists ());
299
296
assertFalse (getResponse .isSourceEmpty ());
@@ -304,7 +301,6 @@ public void testGet() throws IOException {
304
301
GetRequest getRequest = new GetRequest ("index" , "does_not_exist" );
305
302
GetResponse getResponse = execute (getRequest , highLevelClient ()::get , highLevelClient ()::getAsync );
306
303
assertEquals ("index" , getResponse .getIndex ());
307
- assertEquals ("_doc" , getResponse .getType ());
308
304
assertEquals ("does_not_exist" , getResponse .getId ());
309
305
assertFalse (getResponse .isExists ());
310
306
assertEquals (-1 , getResponse .getVersion ());
@@ -316,7 +312,6 @@ public void testGet() throws IOException {
316
312
getRequest .fetchSourceContext (new FetchSourceContext (false , Strings .EMPTY_ARRAY , Strings .EMPTY_ARRAY ));
317
313
GetResponse getResponse = execute (getRequest , highLevelClient ()::get , highLevelClient ()::getAsync );
318
314
assertEquals ("index" , getResponse .getIndex ());
319
- assertEquals ("_doc" , getResponse .getType ());
320
315
assertEquals ("id" , getResponse .getId ());
321
316
assertTrue (getResponse .isExists ());
322
317
assertTrue (getResponse .isSourceEmpty ());
@@ -332,7 +327,6 @@ public void testGet() throws IOException {
332
327
}
333
328
GetResponse getResponse = execute (getRequest , highLevelClient ()::get , highLevelClient ()::getAsync );
334
329
assertEquals ("index" , getResponse .getIndex ());
335
- assertEquals ("_doc" , getResponse .getType ());
336
330
assertEquals ("id" , getResponse .getId ());
337
331
assertTrue (getResponse .isExists ());
338
332
assertFalse (getResponse .isSourceEmpty ());
@@ -353,21 +347,6 @@ public void testGetWithTypes() throws IOException {
353
347
highLevelClient ()::indexAsync ,
354
348
expectWarnings (RestIndexAction .TYPES_DEPRECATION_MESSAGE )
355
349
);
356
-
357
- GetRequest getRequest = new GetRequest ("index" , "type" , "id" );
358
- GetResponse getResponse = execute (getRequest ,
359
- highLevelClient ()::get ,
360
- highLevelClient ()::getAsync ,
361
- expectWarnings (RestGetAction .TYPES_DEPRECATION_MESSAGE ));
362
-
363
- assertEquals ("index" , getResponse .getIndex ());
364
- assertEquals ("type" , getResponse .getType ());
365
- assertEquals ("id" , getResponse .getId ());
366
-
367
- assertTrue (getResponse .isExists ());
368
- assertFalse (getResponse .isSourceEmpty ());
369
- assertEquals (1L , getResponse .getVersion ());
370
- assertEquals (document , getResponse .getSourceAsString ());
371
350
}
372
351
373
352
public void testMultiGet () throws IOException {
@@ -381,15 +360,13 @@ public void testMultiGet() throws IOException {
381
360
assertTrue (response .getResponses ()[0 ].isFailed ());
382
361
assertNull (response .getResponses ()[0 ].getResponse ());
383
362
assertEquals ("id1" , response .getResponses ()[0 ].getFailure ().getId ());
384
- assertNull (response .getResponses ()[0 ].getFailure ().getType ());
385
363
assertEquals ("index" , response .getResponses ()[0 ].getFailure ().getIndex ());
386
364
assertEquals ("Elasticsearch exception [type=index_not_found_exception, reason=no such index [index]]" ,
387
365
response .getResponses ()[0 ].getFailure ().getFailure ().getMessage ());
388
366
389
367
assertTrue (response .getResponses ()[1 ].isFailed ());
390
368
assertNull (response .getResponses ()[1 ].getResponse ());
391
369
assertEquals ("id2" , response .getResponses ()[1 ].getId ());
392
- assertNull (response .getResponses ()[1 ].getType ());
393
370
assertEquals ("index" , response .getResponses ()[1 ].getIndex ());
394
371
assertEquals ("Elasticsearch exception [type=index_not_found_exception, reason=no such index [index]]" ,
395
372
response .getResponses ()[1 ].getFailure ().getFailure ().getMessage ());
@@ -413,14 +390,12 @@ public void testMultiGet() throws IOException {
413
390
assertFalse (response .getResponses ()[0 ].isFailed ());
414
391
assertNull (response .getResponses ()[0 ].getFailure ());
415
392
assertEquals ("id1" , response .getResponses ()[0 ].getId ());
416
- assertEquals ("_doc" , response .getResponses ()[0 ].getType ());
417
393
assertEquals ("index" , response .getResponses ()[0 ].getIndex ());
418
394
assertEquals (Collections .singletonMap ("field" , "value1" ), response .getResponses ()[0 ].getResponse ().getSource ());
419
395
420
396
assertFalse (response .getResponses ()[1 ].isFailed ());
421
397
assertNull (response .getResponses ()[1 ].getFailure ());
422
398
assertEquals ("id2" , response .getResponses ()[1 ].getId ());
423
- assertEquals ("_doc" , response .getResponses ()[1 ].getType ());
424
399
assertEquals ("index" , response .getResponses ()[1 ].getIndex ());
425
400
assertEquals (Collections .singletonMap ("field" , "value2" ), response .getResponses ()[1 ].getResponse ().getSource ());
426
401
}
@@ -437,23 +412,7 @@ public void testMultiGetWithTypes() throws IOException {
437
412
highLevelClient ().bulk (bulk , expectWarnings (RestBulkAction .TYPES_DEPRECATION_MESSAGE ));
438
413
MultiGetRequest multiGetRequest = new MultiGetRequest ();
439
414
multiGetRequest .add ("index" , "id1" );
440
- multiGetRequest .add ("index" , "type" , "id2" );
441
-
442
- MultiGetResponse response = execute (multiGetRequest ,
443
- highLevelClient ()::mget ,
444
- highLevelClient ()::mgetAsync ,
445
- expectWarnings (RestMultiGetAction .TYPES_DEPRECATION_MESSAGE ));
446
- assertEquals (2 , response .getResponses ().length );
447
-
448
- GetResponse firstResponse = response .getResponses ()[0 ].getResponse ();
449
- assertEquals ("index" , firstResponse .getIndex ());
450
- assertEquals ("type" , firstResponse .getType ());
451
- assertEquals ("id1" , firstResponse .getId ());
452
-
453
- GetResponse secondResponse = response .getResponses ()[1 ].getResponse ();
454
- assertEquals ("index" , secondResponse .getIndex ());
455
- assertEquals ("type" , secondResponse .getType ());
456
- assertEquals ("id2" , secondResponse .getId ());
415
+ multiGetRequest .add ("index" , "id2" );
457
416
}
458
417
459
418
public void testIndex () throws IOException {
@@ -972,7 +931,6 @@ public void testUrlEncode() throws IOException {
972
931
GetResponse getResponse = highLevelClient ().get (getRequest , RequestOptions .DEFAULT );
973
932
assertTrue (getResponse .isExists ());
974
933
assertEquals (expectedIndex , getResponse .getIndex ());
975
- assertEquals ("_doc" , getResponse .getType ());
976
934
assertEquals ("id#1" , getResponse .getId ());
977
935
}
978
936
@@ -990,7 +948,6 @@ public void testUrlEncode() throws IOException {
990
948
GetResponse getResponse = highLevelClient ().get (getRequest , RequestOptions .DEFAULT );
991
949
assertTrue (getResponse .isExists ());
992
950
assertEquals ("index" , getResponse .getIndex ());
993
- assertEquals ("_doc" , getResponse .getType ());
994
951
assertEquals (docId , getResponse .getId ());
995
952
}
996
953
@@ -1014,7 +971,6 @@ public void testParamsEncode() throws IOException {
1014
971
GetResponse getResponse = highLevelClient ().get (getRequest , RequestOptions .DEFAULT );
1015
972
assertTrue (getResponse .isExists ());
1016
973
assertEquals ("index" , getResponse .getIndex ());
1017
- assertEquals ("_doc" , getResponse .getType ());
1018
974
assertEquals ("id" , getResponse .getId ());
1019
975
assertEquals (routing , getResponse .getField ("_routing" ).getValue ());
1020
976
}
0 commit comments