49
49
import org .elasticsearch .action .admin .indices .shrink .ResizeRequest ;
50
50
import org .elasticsearch .action .admin .indices .shrink .ResizeResponse ;
51
51
import org .elasticsearch .action .admin .indices .template .delete .DeleteIndexTemplateRequest ;
52
- import org .elasticsearch .action .admin .indices .template .get .GetIndexTemplatesResponse ;
53
- import org .elasticsearch .action .admin .indices .template .put .PutIndexTemplateRequest ;
54
52
import org .elasticsearch .action .admin .indices .validate .query .ValidateQueryRequest ;
55
53
import org .elasticsearch .action .admin .indices .validate .query .ValidateQueryResponse ;
56
54
import org .elasticsearch .action .support .master .AcknowledgedResponse ;
61
59
import org .elasticsearch .client .indices .GetIndexTemplatesRequest ;
62
60
import org .elasticsearch .client .indices .GetMappingsRequest ;
63
61
import org .elasticsearch .client .indices .GetMappingsResponse ;
62
+ import org .elasticsearch .client .indices .GetIndexTemplatesResponse ;
64
63
import org .elasticsearch .client .indices .IndexTemplatesExistRequest ;
64
+ import org .elasticsearch .client .indices .PutIndexTemplateRequest ;
65
65
import org .elasticsearch .client .indices .PutMappingRequest ;
66
66
import org .elasticsearch .client .indices .UnfreezeIndexRequest ;
67
67
import org .elasticsearch .rest .RestStatus ;
@@ -908,6 +908,7 @@ public void putSettingsAsync(UpdateSettingsRequest updateSettingsRequest, Reques
908
908
AcknowledgedResponse ::fromXContent , listener , emptySet ());
909
909
}
910
910
911
+
911
912
/**
912
913
* Puts an index template using the Index Templates API.
913
914
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-templates.html"> Index Templates API
@@ -916,9 +917,13 @@ public void putSettingsAsync(UpdateSettingsRequest updateSettingsRequest, Reques
916
917
* @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
917
918
* @return the response
918
919
* @throws IOException in case there is a problem sending the request or parsing back the response
920
+ * @deprecated This old form of request allows types in mappings. Use {@link #putTemplate(PutIndexTemplateRequest, RequestOptions)}
921
+ * instead which introduces a new request object without types.
919
922
*/
920
- public AcknowledgedResponse putTemplate (PutIndexTemplateRequest putIndexTemplateRequest ,
921
- RequestOptions options ) throws IOException {
923
+ @ Deprecated
924
+ public AcknowledgedResponse putTemplate (
925
+ org .elasticsearch .action .admin .indices .template .put .PutIndexTemplateRequest putIndexTemplateRequest ,
926
+ RequestOptions options ) throws IOException {
922
927
return restHighLevelClient .performRequestAndParseEntity (putIndexTemplateRequest , IndicesRequestConverters ::putTemplate , options ,
923
928
AcknowledgedResponse ::fromXContent , emptySet ());
924
929
}
@@ -930,9 +935,44 @@ public AcknowledgedResponse putTemplate(PutIndexTemplateRequest putIndexTemplate
930
935
* @param putIndexTemplateRequest the request
931
936
* @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
932
937
* @param listener the listener to be notified upon request completion
938
+ * @deprecated This old form of request allows types in mappings.
939
+ * Use {@link #putTemplateAsync(PutIndexTemplateRequest, RequestOptions, ActionListener)}
940
+ * instead which introduces a new request object without types.
933
941
*/
934
- public void putTemplateAsync (PutIndexTemplateRequest putIndexTemplateRequest , RequestOptions options ,
935
- ActionListener <AcknowledgedResponse > listener ) {
942
+ @ Deprecated
943
+ public void putTemplateAsync (org .elasticsearch .action .admin .indices .template .put .PutIndexTemplateRequest putIndexTemplateRequest ,
944
+ RequestOptions options , ActionListener <AcknowledgedResponse > listener ) {
945
+ restHighLevelClient .performRequestAsyncAndParseEntity (putIndexTemplateRequest , IndicesRequestConverters ::putTemplate , options ,
946
+ AcknowledgedResponse ::fromXContent , listener , emptySet ());
947
+ }
948
+
949
+
950
+ /**
951
+ * Puts an index template using the Index Templates API.
952
+ * See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-templates.html"> Index Templates API
953
+ * on elastic.co</a>
954
+ * @param putIndexTemplateRequest the request
955
+ * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
956
+ * @return the response
957
+ * @throws IOException in case there is a problem sending the request or parsing back the response
958
+ */
959
+ public AcknowledgedResponse putTemplate (
960
+ PutIndexTemplateRequest putIndexTemplateRequest ,
961
+ RequestOptions options ) throws IOException {
962
+ return restHighLevelClient .performRequestAndParseEntity (putIndexTemplateRequest , IndicesRequestConverters ::putTemplate , options ,
963
+ AcknowledgedResponse ::fromXContent , emptySet ());
964
+ }
965
+
966
+ /**
967
+ * Asynchronously puts an index template using the Index Templates API.
968
+ * See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-templates.html"> Index Templates API
969
+ * on elastic.co</a>
970
+ * @param putIndexTemplateRequest the request
971
+ * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
972
+ * @param listener the listener to be notified upon request completion
973
+ */
974
+ public void putTemplateAsync (PutIndexTemplateRequest putIndexTemplateRequest ,
975
+ RequestOptions options , ActionListener <AcknowledgedResponse > listener ) {
936
976
restHighLevelClient .performRequestAsyncAndParseEntity (putIndexTemplateRequest , IndicesRequestConverters ::putTemplate , options ,
937
977
AcknowledgedResponse ::fromXContent , listener , emptySet ());
938
978
}
@@ -968,33 +1008,74 @@ public void validateQueryAsync(ValidateQueryRequest validateQueryRequest, Reques
968
1008
}
969
1009
970
1010
/**
971
- * Gets index templates using the Index Templates API
1011
+ * Gets index templates using the Index Templates API. The mappings will be returned in a legacy deprecated format, where the
1012
+ * mapping definition is nested under the type name.
972
1013
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-templates.html"> Index Templates API
973
1014
* on elastic.co</a>
974
1015
* @param getIndexTemplatesRequest the request
975
1016
* @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
976
1017
* @return the response
977
1018
* @throws IOException in case there is a problem sending the request or parsing back the response
1019
+ * @deprecated This method uses an old response object which still refers to types, a deprecated feature. Use
1020
+ * {@link #getIndexTemplate(GetIndexTemplatesRequest, RequestOptions)} instead which returns a new response object
978
1021
*/
979
- public GetIndexTemplatesResponse getTemplate (GetIndexTemplatesRequest getIndexTemplatesRequest ,
980
- RequestOptions options ) throws IOException {
981
- return restHighLevelClient .performRequestAndParseEntity (getIndexTemplatesRequest , IndicesRequestConverters ::getTemplates ,
982
- options , GetIndexTemplatesResponse ::fromXContent , emptySet ());
1022
+ @ Deprecated
1023
+ public org .elasticsearch .action .admin .indices .template .get .GetIndexTemplatesResponse getTemplate (
1024
+ GetIndexTemplatesRequest getIndexTemplatesRequest , RequestOptions options ) throws IOException {
1025
+ return restHighLevelClient .performRequestAndParseEntity (getIndexTemplatesRequest ,
1026
+ IndicesRequestConverters ::getTemplatesWithDocumentTypes ,
1027
+ options , org .elasticsearch .action .admin .indices .template .get .GetIndexTemplatesResponse ::fromXContent , emptySet ());
983
1028
}
1029
+
1030
+ /**
1031
+ * Gets index templates using the Index Templates API
1032
+ * See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-templates.html"> Index Templates API
1033
+ * on elastic.co</a>
1034
+ * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
1035
+ * @param getIndexTemplatesRequest the request
1036
+ * @return the response
1037
+ * @throws IOException in case there is a problem sending the request or parsing back the response
1038
+ */
1039
+ public GetIndexTemplatesResponse getIndexTemplate (GetIndexTemplatesRequest getIndexTemplatesRequest , RequestOptions options )
1040
+ throws IOException {
1041
+ return restHighLevelClient .performRequestAndParseEntity (getIndexTemplatesRequest ,
1042
+ IndicesRequestConverters ::getTemplates ,
1043
+ options , GetIndexTemplatesResponse ::fromXContent , emptySet ());
1044
+ }
984
1045
985
1046
/**
986
- * Asynchronously gets index templates using the Index Templates API
1047
+ * Asynchronously gets index templates using the Index Templates API. The mappings will be returned in a legacy deprecated format,
1048
+ * where the mapping definition is nested under the type name.
987
1049
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-templates.html"> Index Templates API
988
1050
* on elastic.co</a>
989
1051
* @param getIndexTemplatesRequest the request
990
1052
* @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
991
1053
* @param listener the listener to be notified upon request completion
1054
+ * @deprecated This method uses an old response object which still refers to types, a deprecated feature. Use
1055
+ * {@link #getIndexTemplateAsync(GetIndexTemplatesRequest, RequestOptions, ActionListener)} instead which returns a new response object
992
1056
*/
1057
+ @ Deprecated
993
1058
public void getTemplateAsync (GetIndexTemplatesRequest getIndexTemplatesRequest , RequestOptions options ,
1059
+ ActionListener <org .elasticsearch .action .admin .indices .template .get .GetIndexTemplatesResponse > listener ) {
1060
+ restHighLevelClient .performRequestAsyncAndParseEntity (getIndexTemplatesRequest ,
1061
+ IndicesRequestConverters ::getTemplatesWithDocumentTypes ,
1062
+ options , org .elasticsearch .action .admin .indices .template .get .GetIndexTemplatesResponse ::fromXContent , listener , emptySet ());
1063
+ }
1064
+
1065
+ /**
1066
+ * Asynchronously gets index templates using the Index Templates API
1067
+ * See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-templates.html"> Index Templates API
1068
+ * on elastic.co</a>
1069
+ * @param getIndexTemplatesRequest the request
1070
+ * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
1071
+ * @param listener the listener to be notified upon request completion
1072
+ */
1073
+ public void getIndexTemplateAsync (GetIndexTemplatesRequest getIndexTemplatesRequest , RequestOptions options ,
994
1074
ActionListener <GetIndexTemplatesResponse > listener ) {
995
- restHighLevelClient .performRequestAsyncAndParseEntity (getIndexTemplatesRequest , IndicesRequestConverters ::getTemplates ,
1075
+ restHighLevelClient .performRequestAsyncAndParseEntity (getIndexTemplatesRequest ,
1076
+ IndicesRequestConverters ::getTemplates ,
996
1077
options , GetIndexTemplatesResponse ::fromXContent , listener , emptySet ());
997
- }
1078
+ }
998
1079
999
1080
/**
1000
1081
* Uses the Index Templates API to determine if index templates exist
0 commit comments