4949import org .elasticsearch .action .admin .indices .shrink .ResizeRequest ;
5050import org .elasticsearch .action .admin .indices .shrink .ResizeResponse ;
5151import 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 ;
5452import org .elasticsearch .action .admin .indices .validate .query .ValidateQueryRequest ;
5553import org .elasticsearch .action .admin .indices .validate .query .ValidateQueryResponse ;
5654import org .elasticsearch .action .support .master .AcknowledgedResponse ;
6159import org .elasticsearch .client .indices .GetIndexTemplatesRequest ;
6260import org .elasticsearch .client .indices .GetMappingsRequest ;
6361import org .elasticsearch .client .indices .GetMappingsResponse ;
62+ import org .elasticsearch .client .indices .GetIndexTemplatesResponse ;
6463import org .elasticsearch .client .indices .IndexTemplatesExistRequest ;
64+ import org .elasticsearch .client .indices .PutIndexTemplateRequest ;
6565import org .elasticsearch .client .indices .PutMappingRequest ;
6666import org .elasticsearch .client .indices .UnfreezeIndexRequest ;
6767import org .elasticsearch .rest .RestStatus ;
@@ -908,6 +908,7 @@ public void putSettingsAsync(UpdateSettingsRequest updateSettingsRequest, Reques
908908 AcknowledgedResponse ::fromXContent , listener , emptySet ());
909909 }
910910
911+
911912 /**
912913 * Puts an index template using the Index Templates API.
913914 * 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
916917 * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
917918 * @return the response
918919 * @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.
919922 */
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 {
922927 return restHighLevelClient .performRequestAndParseEntity (putIndexTemplateRequest , IndicesRequestConverters ::putTemplate , options ,
923928 AcknowledgedResponse ::fromXContent , emptySet ());
924929 }
@@ -930,9 +935,44 @@ public AcknowledgedResponse putTemplate(PutIndexTemplateRequest putIndexTemplate
930935 * @param putIndexTemplateRequest the request
931936 * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
932937 * @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.
933941 */
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 ) {
936976 restHighLevelClient .performRequestAsyncAndParseEntity (putIndexTemplateRequest , IndicesRequestConverters ::putTemplate , options ,
937977 AcknowledgedResponse ::fromXContent , listener , emptySet ());
938978 }
@@ -968,33 +1008,74 @@ public void validateQueryAsync(ValidateQueryRequest validateQueryRequest, Reques
9681008 }
9691009
9701010 /**
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.
9721013 * See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-templates.html"> Index Templates API
9731014 * on elastic.co</a>
9741015 * @param getIndexTemplatesRequest the request
9751016 * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
9761017 * @return the response
9771018 * @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
9781021 */
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 ());
9831028 }
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+ }
9841045
9851046 /**
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.
9871049 * See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-templates.html"> Index Templates API
9881050 * on elastic.co</a>
9891051 * @param getIndexTemplatesRequest the request
9901052 * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
9911053 * @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
9921056 */
1057+ @ Deprecated
9931058 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 ,
9941074 ActionListener <GetIndexTemplatesResponse > listener ) {
995- restHighLevelClient .performRequestAsyncAndParseEntity (getIndexTemplatesRequest , IndicesRequestConverters ::getTemplates ,
1075+ restHighLevelClient .performRequestAsyncAndParseEntity (getIndexTemplatesRequest ,
1076+ IndicesRequestConverters ::getTemplates ,
9961077 options , GetIndexTemplatesResponse ::fromXContent , listener , emptySet ());
997- }
1078+ }
9981079
9991080 /**
10001081 * Uses the Index Templates API to determine if index templates exist
0 commit comments