@@ -630,10 +630,9 @@ public void testUpdate() throws IOException {
630630
631631 Map <String , String > expectedParams = new HashMap <>();
632632 String index = randomAlphaOfLengthBetween (3 , 10 );
633- String type = randomAlphaOfLengthBetween (3 , 10 );
634633 String id = randomAlphaOfLengthBetween (3 , 10 );
635634
636- UpdateRequest updateRequest = new UpdateRequest (index , type , id );
635+ UpdateRequest updateRequest = new UpdateRequest (index , id );
637636 updateRequest .detectNoop (randomBoolean ());
638637
639638 if (randomBoolean ()) {
@@ -687,7 +686,7 @@ public void testUpdate() throws IOException {
687686 }
688687
689688 Request request = RequestConverters .update (updateRequest );
690- assertEquals ("/" + index + "/" + type + " /" + id + "/_update" , request .getEndpoint ());
689+ assertEquals ("/" + index + "/_update /" + id , request .getEndpoint ());
691690 assertEquals (expectedParams , request .getParameters ());
692691 assertEquals (HttpPost .METHOD_NAME , request .getMethod ());
693692
@@ -718,6 +717,23 @@ public void testUpdate() throws IOException {
718717 }
719718 }
720719
720+ public void testUpdateWithType () throws IOException {
721+ String index = randomAlphaOfLengthBetween (3 , 10 );
722+ String type = randomAlphaOfLengthBetween (3 , 10 );
723+ String id = randomAlphaOfLengthBetween (3 , 10 );
724+
725+ UpdateRequest updateRequest = new UpdateRequest (index , type , id );
726+
727+ XContentType xContentType = XContentType .JSON ;
728+ BytesReference source = RandomObjects .randomSource (random (), xContentType );
729+ updateRequest .doc (new IndexRequest ().source (source , xContentType ));
730+
731+ Request request = RequestConverters .update (updateRequest );
732+ assertEquals ("/" + index + "/" + type + "/" + id + "/_update" , request .getEndpoint ());
733+ assertEquals (HttpPost .METHOD_NAME , request .getMethod ());
734+ assertToXContentBody (updateRequest , request .getEntity ());
735+ }
736+
721737 public void testUpdateWithDifferentContentTypes () {
722738 IllegalStateException exception = expectThrows (IllegalStateException .class , () -> {
723739 UpdateRequest updateRequest = new UpdateRequest ();
0 commit comments