48
48
import org .elasticsearch .action .admin .indices .alias .IndicesAliasesRequest ;
49
49
import org .elasticsearch .action .admin .indices .alias .get .GetAliasesRequest ;
50
50
import org .elasticsearch .action .admin .indices .close .CloseIndexRequest ;
51
- import org .elasticsearch .action .admin .indices .create .CreateIndexRequest ;
52
51
import org .elasticsearch .action .admin .indices .delete .DeleteIndexRequest ;
53
52
import org .elasticsearch .action .admin .indices .flush .FlushRequest ;
54
53
import org .elasticsearch .action .admin .indices .flush .FlushResponse ;
55
- import org .elasticsearch .action .admin .indices .get .GetIndexRequest ;
56
- import org .elasticsearch .action .admin .indices .mapping .get .GetMappingsRequest ;
57
- import org .elasticsearch .action .admin .indices .mapping .get .GetMappingsResponse ;
58
- import org .elasticsearch .action .admin .indices .mapping .put .PutMappingRequest ;
59
54
import org .elasticsearch .action .admin .indices .open .OpenIndexRequest ;
60
55
import org .elasticsearch .action .admin .indices .refresh .RefreshRequest ;
61
56
import org .elasticsearch .action .admin .indices .refresh .RefreshResponse ;
84
79
import org .elasticsearch .action .update .UpdateResponse ;
85
80
import org .elasticsearch .client .GetAliasesResponse ;
86
81
import org .elasticsearch .client .Request ;
82
+ import org .elasticsearch .client .indices .CreateIndexRequest ;
87
83
import org .elasticsearch .client .indices .GetFieldMappingsRequest ;
88
84
import org .elasticsearch .client .indices .GetFieldMappingsResponse ;
85
+ import org .elasticsearch .client .indices .GetIndexRequest ;
89
86
import org .elasticsearch .client .indices .GetIndexResponse ;
90
87
import org .elasticsearch .client .indices .GetIndexTemplatesRequest ;
91
88
import org .elasticsearch .client .indices .GetIndexTemplatesResponse ;
89
+ import org .elasticsearch .client .indices .GetMappingsRequest ;
90
+ import org .elasticsearch .client .indices .GetMappingsResponse ;
92
91
import org .elasticsearch .client .indices .IndexTemplatesExistRequest ;
93
92
import org .elasticsearch .client .indices .PutIndexTemplateRequest ;
93
+ import org .elasticsearch .client .indices .PutMappingRequest ;
94
94
import org .elasticsearch .common .unit .TimeValue ;
95
95
import org .elasticsearch .common .xcontent .DeprecationHandler ;
96
96
import org .elasticsearch .common .xcontent .NamedXContentRegistry ;
@@ -646,13 +646,22 @@ private RequestBodySpec sendRequest(WebClient webClient, String logId, Request r
646
646
647
647
// region indices operations
648
648
@ Override
649
- public Mono <Boolean > createIndex (HttpHeaders headers , CreateIndexRequest createIndexRequest ) {
649
+ public Mono <Boolean > createIndex (HttpHeaders headers ,
650
+ org .elasticsearch .action .admin .indices .create .CreateIndexRequest createIndexRequest ) {
650
651
651
652
return sendRequest (createIndexRequest , requestCreator .indexCreate (), AcknowledgedResponse .class , headers ) //
652
653
.map (AcknowledgedResponse ::isAcknowledged ) //
653
654
.next ();
654
655
}
655
656
657
+ @ Override
658
+ public Mono <Boolean > createIndex (HttpHeaders headers , CreateIndexRequest createIndexRequest ) {
659
+
660
+ return sendRequest (createIndexRequest , requestCreator .createIndexRequest (), AcknowledgedResponse .class , headers ) //
661
+ .map (AcknowledgedResponse ::isAcknowledged ) //
662
+ .next ();
663
+ }
664
+
656
665
@ Override
657
666
public Mono <Void > closeIndex (HttpHeaders headers , CloseIndexRequest closeIndexRequest ) {
658
667
@@ -661,14 +670,21 @@ public Mono<Void> closeIndex(HttpHeaders headers, CloseIndexRequest closeIndexRe
661
670
}
662
671
663
672
@ Override
664
- public Mono <Boolean > existsIndex (HttpHeaders headers , GetIndexRequest request ) {
673
+ public Mono <Boolean > existsIndex (HttpHeaders headers , org . elasticsearch . action . admin . indices . get . GetIndexRequest request ) {
665
674
666
675
return sendRequest (request , requestCreator .indexExists (), RawActionResponse .class , headers ) //
667
676
.flatMap (response -> response .releaseBody ().thenReturn (response .statusCode ().is2xxSuccessful ())) //
668
677
.next ();
669
678
}
670
679
671
- @ Override
680
+ @ Override
681
+ public Mono <Boolean > existsIndex (HttpHeaders headers , GetIndexRequest request ) {
682
+ return sendRequest (request , requestCreator .indexExistsRequest (), RawActionResponse .class , headers ) //
683
+ .flatMap (response -> response .releaseBody ().thenReturn (response .statusCode ().is2xxSuccessful ())) //
684
+ .next ();
685
+ }
686
+
687
+ @ Override
672
688
public Mono <Boolean > deleteIndex (HttpHeaders headers , DeleteIndexRequest request ) {
673
689
674
690
return sendRequest (request , requestCreator .indexDelete (), AcknowledgedResponse .class , headers ) //
@@ -683,9 +699,17 @@ public Mono<Void> flushIndex(HttpHeaders headers, FlushRequest flushRequest) {
683
699
.then ();
684
700
}
685
701
702
+ @ Override
703
+ public Mono <org .elasticsearch .action .admin .indices .mapping .get .GetMappingsResponse > getMapping (HttpHeaders headers ,
704
+ org .elasticsearch .action .admin .indices .mapping .get .GetMappingsRequest getMappingsRequest ) {
705
+ return sendRequest (getMappingsRequest , requestCreator .getMapping (),
706
+ org .elasticsearch .action .admin .indices .mapping .get .GetMappingsResponse .class , headers ).next ();
707
+ }
708
+
686
709
@ Override
687
710
public Mono <GetMappingsResponse > getMapping (HttpHeaders headers , GetMappingsRequest getMappingsRequest ) {
688
- return sendRequest (getMappingsRequest , requestCreator .getMapping (), GetMappingsResponse .class , headers ).next ();
711
+ return sendRequest (getMappingsRequest , requestCreator .getMappingRequest (), GetMappingsResponse .class , headers ) //
712
+ .next ();
689
713
}
690
714
691
715
@ Override
@@ -701,13 +725,21 @@ public Mono<GetSettingsResponse> getSettings(HttpHeaders headers, GetSettingsReq
701
725
}
702
726
703
727
@ Override
704
- public Mono <Boolean > putMapping (HttpHeaders headers , PutMappingRequest putMappingRequest ) {
728
+ public Mono <Boolean > putMapping (HttpHeaders headers ,
729
+ org .elasticsearch .action .admin .indices .mapping .put .PutMappingRequest putMappingRequest ) {
705
730
706
731
return sendRequest (putMappingRequest , requestCreator .putMapping (), AcknowledgedResponse .class , headers ) //
707
732
.map (AcknowledgedResponse ::isAcknowledged ) //
708
733
.next ();
709
734
}
710
735
736
+ @ Override
737
+ public Mono <Boolean > putMapping (HttpHeaders headers , PutMappingRequest putMappingRequest ) {
738
+ return sendRequest (putMappingRequest , requestCreator .putMappingRequest (), AcknowledgedResponse .class , headers ) //
739
+ .map (AcknowledgedResponse ::isAcknowledged ) //
740
+ .next ();
741
+ }
742
+
711
743
@ Override
712
744
public Mono <Void > openIndex (HttpHeaders headers , OpenIndexRequest request ) {
713
745
@@ -760,8 +792,7 @@ public Mono<Boolean> deleteTemplate(HttpHeaders headers, DeleteIndexTemplateRequ
760
792
}
761
793
762
794
@ Override
763
- public Mono <GetIndexResponse > getIndex (HttpHeaders headers ,
764
- org .elasticsearch .client .indices .GetIndexRequest getIndexRequest ) {
795
+ public Mono <GetIndexResponse > getIndex (HttpHeaders headers , GetIndexRequest getIndexRequest ) {
765
796
return sendRequest (getIndexRequest , requestCreator .getIndex (), GetIndexResponse .class , headers ).next ();
766
797
}
767
798
0 commit comments