48
48
import org .elasticsearch .client .indices .CreateIndexRequest ;
49
49
import org .elasticsearch .client .indices .CreateIndexResponse ;
50
50
import org .elasticsearch .client .indices .DeleteAliasRequest ;
51
+ import org .elasticsearch .client .indices .DeleteIndexTemplateV2Request ;
51
52
import org .elasticsearch .client .indices .FreezeIndexRequest ;
52
53
import org .elasticsearch .client .indices .GetFieldMappingsRequest ;
53
54
import org .elasticsearch .client .indices .GetFieldMappingsResponse ;
54
55
import org .elasticsearch .client .indices .GetIndexRequest ;
55
56
import org .elasticsearch .client .indices .GetIndexResponse ;
56
57
import org .elasticsearch .client .indices .GetIndexTemplatesRequest ;
57
58
import org .elasticsearch .client .indices .GetIndexTemplatesResponse ;
59
+ import org .elasticsearch .client .indices .GetIndexTemplateV2Request ;
60
+ import org .elasticsearch .client .indices .GetIndexTemplatesV2Response ;
58
61
import org .elasticsearch .client .indices .GetMappingsRequest ;
59
62
import org .elasticsearch .client .indices .GetMappingsResponse ;
63
+ import org .elasticsearch .client .indices .IndexTemplateV2ExistRequest ;
60
64
import org .elasticsearch .client .indices .IndexTemplatesExistRequest ;
61
65
import org .elasticsearch .client .indices .PutIndexTemplateRequest ;
66
+ import org .elasticsearch .client .indices .PutIndexTemplateV2Request ;
62
67
import org .elasticsearch .client .indices .PutMappingRequest ;
63
68
import org .elasticsearch .client .indices .ReloadAnalyzersRequest ;
64
69
import org .elasticsearch .client .indices .ReloadAnalyzersResponse ;
@@ -909,6 +914,36 @@ public Cancellable putTemplateAsync(PutIndexTemplateRequest putIndexTemplateRequ
909
914
AcknowledgedResponse ::fromXContent , listener , emptySet ());
910
915
}
911
916
917
+ /**
918
+ * Puts an index template using the Index Templates API.
919
+ * See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-templates.html"> Index Templates API
920
+ * on elastic.co</a>
921
+ * @param putIndexTemplateRequest the request
922
+ * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
923
+ * @return the response
924
+ * @throws IOException in case there is a problem sending the request or parsing back the response
925
+ */
926
+ public AcknowledgedResponse putIndexTemplate (PutIndexTemplateV2Request putIndexTemplateRequest , RequestOptions options )
927
+ throws IOException {
928
+ return restHighLevelClient .performRequestAndParseEntity (putIndexTemplateRequest , IndicesRequestConverters ::putIndexTemplate ,
929
+ options , AcknowledgedResponse ::fromXContent , emptySet ());
930
+ }
931
+
932
+ /**
933
+ * Asynchronously puts an index template using the Index Templates API.
934
+ * See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-templates.html"> Index Templates API
935
+ * on elastic.co</a>
936
+ * @param putIndexTemplateRequest the request
937
+ * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
938
+ * @param listener the listener to be notified upon request completion
939
+ * @return cancellable that may be used to cancel the request
940
+ */
941
+ public Cancellable putIndexTemplateAsync (PutIndexTemplateV2Request putIndexTemplateRequest ,
942
+ RequestOptions options , ActionListener <AcknowledgedResponse > listener ) {
943
+ return restHighLevelClient .performRequestAsyncAndParseEntity (putIndexTemplateRequest , IndicesRequestConverters ::putIndexTemplate ,
944
+ options , AcknowledgedResponse ::fromXContent , listener , emptySet ());
945
+ }
946
+
912
947
/**
913
948
* Validate a potentially expensive query without executing it.
914
949
* <p>
@@ -943,6 +978,36 @@ public Cancellable validateQueryAsync(ValidateQueryRequest validateQueryRequest,
943
978
ValidateQueryResponse ::fromXContent , listener , emptySet ());
944
979
}
945
980
981
+ /**
982
+ * Gets index templates using the Index Templates API
983
+ * See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-templates.html"> Index Templates API
984
+ * on elastic.co</a>
985
+ * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
986
+ * @param getIndexTemplatesRequest the request
987
+ * @return the response
988
+ * @throws IOException in case there is a problem sending the request or parsing back the response
989
+ */
990
+ public GetIndexTemplatesV2Response getIndexTemplate (GetIndexTemplateV2Request getIndexTemplatesRequest ,
991
+ RequestOptions options ) throws IOException {
992
+ return restHighLevelClient .performRequestAndParseEntity (getIndexTemplatesRequest , IndicesRequestConverters ::getIndexTemplates ,
993
+ options , GetIndexTemplatesV2Response ::fromXContent , emptySet ());
994
+ }
995
+
996
+ /**
997
+ * Asynchronously gets index templates using the Index Templates API
998
+ * See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-templates.html"> Index Templates API
999
+ * on elastic.co</a>
1000
+ * @param getIndexTemplatesRequest the request
1001
+ * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
1002
+ * @param listener the listener to be notified upon request completion
1003
+ * @return cancellable that may be used to cancel the request
1004
+ */
1005
+ public Cancellable getIndexTemplateAsync (GetIndexTemplateV2Request getIndexTemplatesRequest , RequestOptions options ,
1006
+ ActionListener <GetIndexTemplatesV2Response > listener ) {
1007
+ return restHighLevelClient .performRequestAsyncAndParseEntity (getIndexTemplatesRequest ,
1008
+ IndicesRequestConverters ::getIndexTemplates , options , GetIndexTemplatesV2Response ::fromXContent , listener , emptySet ());
1009
+ }
1010
+
946
1011
/**
947
1012
* Gets index templates using the Index Templates API
948
1013
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-templates.html"> Index Templates API
@@ -953,7 +1018,7 @@ public Cancellable validateQueryAsync(ValidateQueryRequest validateQueryRequest,
953
1018
* @throws IOException in case there is a problem sending the request or parsing back the response
954
1019
*/
955
1020
public GetIndexTemplatesResponse getIndexTemplate (GetIndexTemplatesRequest getIndexTemplatesRequest ,
956
- RequestOptions options ) throws IOException {
1021
+ RequestOptions options ) throws IOException {
957
1022
return restHighLevelClient .performRequestAndParseEntity (getIndexTemplatesRequest ,
958
1023
IndicesRequestConverters ::getTemplates ,
959
1024
options , GetIndexTemplatesResponse ::fromXContent , emptySet ());
@@ -1006,6 +1071,37 @@ public Cancellable existsTemplateAsync(IndexTemplatesExistRequest indexTemplates
1006
1071
RestHighLevelClient ::convertExistsResponse , listener , emptySet ());
1007
1072
}
1008
1073
1074
+ /**
1075
+ * Uses the Index Templates API to determine if index templates exist
1076
+ *
1077
+ * @param indexTemplatesRequest the request
1078
+ * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
1079
+ * @return true if any index templates in the request exist, false otherwise
1080
+ * @throws IOException in case there is a problem sending the request or parsing back the response
1081
+ */
1082
+ public boolean existsIndexTemplate (IndexTemplateV2ExistRequest indexTemplatesRequest ,
1083
+ RequestOptions options ) throws IOException {
1084
+ return restHighLevelClient .performRequest (indexTemplatesRequest ,
1085
+ IndicesRequestConverters ::templatesExist , options ,
1086
+ RestHighLevelClient ::convertExistsResponse , emptySet ());
1087
+ }
1088
+
1089
+ /**
1090
+ * Uses the Index Templates API to determine if index templates exist
1091
+ * @param indexTemplatesExistRequest the request
1092
+ * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
1093
+ * @param listener the listener to be notified upon request completion. The listener will be called with the value {@code true}
1094
+ * @return cancellable that may be used to cancel the request
1095
+ */
1096
+ public Cancellable existsIndexTemplateAsync (IndexTemplateV2ExistRequest indexTemplatesExistRequest ,
1097
+ RequestOptions options ,
1098
+ ActionListener <Boolean > listener ) {
1099
+
1100
+ return restHighLevelClient .performRequestAsync (indexTemplatesExistRequest ,
1101
+ IndicesRequestConverters ::templatesExist , options ,
1102
+ RestHighLevelClient ::convertExistsResponse , listener , emptySet ());
1103
+ }
1104
+
1009
1105
/**
1010
1106
* Calls the analyze API
1011
1107
*
@@ -1112,6 +1208,35 @@ public Cancellable deleteTemplateAsync(DeleteIndexTemplateRequest request, Reque
1112
1208
options , AcknowledgedResponse ::fromXContent , listener , emptySet ());
1113
1209
}
1114
1210
1211
+ /**
1212
+ * Delete an index template using the Index Templates API
1213
+ * See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-templates.html"> Index Templates API
1214
+ * on elastic.co</a>
1215
+ *
1216
+ * @param request the request
1217
+ * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
1218
+ * @throws IOException in case there is a problem sending the request or parsing back the response
1219
+ */
1220
+ public AcknowledgedResponse deleteIndexTemplate (DeleteIndexTemplateV2Request request , RequestOptions options ) throws IOException {
1221
+ return restHighLevelClient .performRequestAndParseEntity (request , IndicesRequestConverters ::deleteIndexTemplate ,
1222
+ options , AcknowledgedResponse ::fromXContent , emptySet ());
1223
+ }
1224
+
1225
+ /**
1226
+ * Asynchronously delete an index template using the Index Templates API
1227
+ * See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-templates.html"> Index Templates API
1228
+ * on elastic.co</a>
1229
+ * @param request the request
1230
+ * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
1231
+ * @param listener the listener to be notified upon request completion
1232
+ * @return cancellable that may be used to cancel the request
1233
+ */
1234
+ public Cancellable deleteIndexTemplateAsync (DeleteIndexTemplateV2Request request , RequestOptions options ,
1235
+ ActionListener <AcknowledgedResponse > listener ) {
1236
+ return restHighLevelClient .performRequestAsyncAndParseEntity (request , IndicesRequestConverters ::deleteIndexTemplate ,
1237
+ options , AcknowledgedResponse ::fromXContent , listener , emptySet ());
1238
+ }
1239
+
1115
1240
/**
1116
1241
* Synchronously calls the _reload_search_analyzers API
1117
1242
*
0 commit comments