5050import org .elasticsearch .action .admin .indices .shrink .ResizeRequest ;
5151import org .elasticsearch .action .admin .indices .shrink .ResizeResponse ;
5252import org .elasticsearch .action .admin .indices .template .delete .DeleteIndexTemplateRequest ;
53- import org .elasticsearch .action .admin .indices .template .get .GetIndexTemplatesResponse ;
54- import org .elasticsearch .action .admin .indices .template .put .PutIndexTemplateRequest ;
5553import org .elasticsearch .action .admin .indices .validate .query .ValidateQueryRequest ;
5654import org .elasticsearch .action .admin .indices .validate .query .ValidateQueryResponse ;
5755import org .elasticsearch .action .support .master .AcknowledgedResponse ;
6260import org .elasticsearch .client .indices .GetIndexTemplatesRequest ;
6361import org .elasticsearch .client .indices .GetMappingsRequest ;
6462import org .elasticsearch .client .indices .GetMappingsResponse ;
63+ import org .elasticsearch .client .indices .GetIndexTemplatesResponse ;
6564import org .elasticsearch .client .indices .IndexTemplatesExistRequest ;
65+ import org .elasticsearch .client .indices .PutIndexTemplateRequest ;
6666import org .elasticsearch .client .indices .PutMappingRequest ;
6767import org .elasticsearch .client .indices .UnfreezeIndexRequest ;
6868import org .elasticsearch .rest .RestStatus ;
@@ -1341,6 +1341,7 @@ public void putSettingsAsync(UpdateSettingsRequest updateSettingsRequest, Reques
13411341 AcknowledgedResponse ::fromXContent , listener , emptySet ());
13421342 }
13431343
1344+
13441345 /**
13451346 * Asynchronously updates specific index level settings using the Update Indices Settings API.
13461347 * <p>
@@ -1363,9 +1364,13 @@ public void putSettingsAsync(UpdateSettingsRequest updateSettingsRequest, Action
13631364 * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
13641365 * @return the response
13651366 * @throws IOException in case there is a problem sending the request or parsing back the response
1367+ * @deprecated This old form of request allows types in mappings. Use {@link #putTemplate(PutIndexTemplateRequest, RequestOptions)}
1368+ * instead which introduces a new request object without types.
13661369 */
1367- public AcknowledgedResponse putTemplate (PutIndexTemplateRequest putIndexTemplateRequest ,
1368- RequestOptions options ) throws IOException {
1370+ @ Deprecated
1371+ public AcknowledgedResponse putTemplate (
1372+ org .elasticsearch .action .admin .indices .template .put .PutIndexTemplateRequest putIndexTemplateRequest ,
1373+ RequestOptions options ) throws IOException {
13691374 return restHighLevelClient .performRequestAndParseEntity (putIndexTemplateRequest , IndicesRequestConverters ::putTemplate , options ,
13701375 AcknowledgedResponse ::fromXContent , emptySet ());
13711376 }
@@ -1377,9 +1382,44 @@ public AcknowledgedResponse putTemplate(PutIndexTemplateRequest putIndexTemplate
13771382 * @param putIndexTemplateRequest the request
13781383 * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
13791384 * @param listener the listener to be notified upon request completion
1385+ * @deprecated This old form of request allows types in mappings.
1386+ * Use {@link #putTemplateAsync(PutIndexTemplateRequest, RequestOptions, ActionListener)}
1387+ * instead which introduces a new request object without types.
13801388 */
1381- public void putTemplateAsync (PutIndexTemplateRequest putIndexTemplateRequest , RequestOptions options ,
1382- ActionListener <AcknowledgedResponse > listener ) {
1389+ @ Deprecated
1390+ public void putTemplateAsync (org .elasticsearch .action .admin .indices .template .put .PutIndexTemplateRequest putIndexTemplateRequest ,
1391+ RequestOptions options , ActionListener <AcknowledgedResponse > listener ) {
1392+ restHighLevelClient .performRequestAsyncAndParseEntity (putIndexTemplateRequest , IndicesRequestConverters ::putTemplate , options ,
1393+ AcknowledgedResponse ::fromXContent , listener , emptySet ());
1394+ }
1395+
1396+
1397+ /**
1398+ * Puts an index template using the Index Templates API.
1399+ * See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-templates.html"> Index Templates API
1400+ * on elastic.co</a>
1401+ * @param putIndexTemplateRequest the request
1402+ * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
1403+ * @return the response
1404+ * @throws IOException in case there is a problem sending the request or parsing back the response
1405+ */
1406+ public AcknowledgedResponse putTemplate (
1407+ PutIndexTemplateRequest putIndexTemplateRequest ,
1408+ RequestOptions options ) throws IOException {
1409+ return restHighLevelClient .performRequestAndParseEntity (putIndexTemplateRequest , IndicesRequestConverters ::putTemplate , options ,
1410+ AcknowledgedResponse ::fromXContent , emptySet ());
1411+ }
1412+
1413+ /**
1414+ * Asynchronously puts an index template using the Index Templates API.
1415+ * See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-templates.html"> Index Templates API
1416+ * on elastic.co</a>
1417+ * @param putIndexTemplateRequest the request
1418+ * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
1419+ * @param listener the listener to be notified upon request completion
1420+ */
1421+ public void putTemplateAsync (PutIndexTemplateRequest putIndexTemplateRequest ,
1422+ RequestOptions options , ActionListener <AcknowledgedResponse > listener ) {
13831423 restHighLevelClient .performRequestAsyncAndParseEntity (putIndexTemplateRequest , IndicesRequestConverters ::putTemplate , options ,
13841424 AcknowledgedResponse ::fromXContent , listener , emptySet ());
13851425 }
@@ -1415,33 +1455,74 @@ public void validateQueryAsync(ValidateQueryRequest validateQueryRequest, Reques
14151455 }
14161456
14171457 /**
1418- * Gets index templates using the Index Templates API
1458+ * Gets index templates using the Index Templates API. The mappings will be returned in a legacy deprecated format, where the
1459+ * mapping definition is nested under the type name.
14191460 * See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-templates.html"> Index Templates API
14201461 * on elastic.co</a>
14211462 * @param getIndexTemplatesRequest the request
14221463 * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
14231464 * @return the response
14241465 * @throws IOException in case there is a problem sending the request or parsing back the response
1466+ * @deprecated This method uses an old response object which still refers to types, a deprecated feature. Use
1467+ * {@link #getIndexTemplate(GetIndexTemplatesRequest, RequestOptions)} instead which returns a new response object
14251468 */
1426- public GetIndexTemplatesResponse getTemplate (GetIndexTemplatesRequest getIndexTemplatesRequest ,
1427- RequestOptions options ) throws IOException {
1428- return restHighLevelClient .performRequestAndParseEntity (getIndexTemplatesRequest , IndicesRequestConverters ::getTemplates ,
1429- options , GetIndexTemplatesResponse ::fromXContent , emptySet ());
1469+ @ Deprecated
1470+ public org .elasticsearch .action .admin .indices .template .get .GetIndexTemplatesResponse getTemplate (
1471+ GetIndexTemplatesRequest getIndexTemplatesRequest , RequestOptions options ) throws IOException {
1472+ return restHighLevelClient .performRequestAndParseEntity (getIndexTemplatesRequest ,
1473+ IndicesRequestConverters ::getTemplatesWithDocumentTypes ,
1474+ options , org .elasticsearch .action .admin .indices .template .get .GetIndexTemplatesResponse ::fromXContent , emptySet ());
14301475 }
1476+
1477+ /**
1478+ * Gets index templates using the Index Templates API
1479+ * See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-templates.html"> Index Templates API
1480+ * on elastic.co</a>
1481+ * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
1482+ * @param getIndexTemplatesRequest the request
1483+ * @return the response
1484+ * @throws IOException in case there is a problem sending the request or parsing back the response
1485+ */
1486+ public GetIndexTemplatesResponse getIndexTemplate (GetIndexTemplatesRequest getIndexTemplatesRequest , RequestOptions options )
1487+ throws IOException {
1488+ return restHighLevelClient .performRequestAndParseEntity (getIndexTemplatesRequest ,
1489+ IndicesRequestConverters ::getTemplates ,
1490+ options , GetIndexTemplatesResponse ::fromXContent , emptySet ());
1491+ }
14311492
14321493 /**
1433- * Asynchronously gets index templates using the Index Templates API
1494+ * Asynchronously gets index templates using the Index Templates API. The mappings will be returned in a legacy deprecated format,
1495+ * where the mapping definition is nested under the type name.
14341496 * See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-templates.html"> Index Templates API
14351497 * on elastic.co</a>
14361498 * @param getIndexTemplatesRequest the request
14371499 * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
14381500 * @param listener the listener to be notified upon request completion
1501+ * @deprecated This method uses an old response object which still refers to types, a deprecated feature. Use
1502+ * {@link #getIndexTemplateAsync(GetIndexTemplatesRequest, RequestOptions, ActionListener)} instead which returns a new response object
14391503 */
1504+ @ Deprecated
14401505 public void getTemplateAsync (GetIndexTemplatesRequest getIndexTemplatesRequest , RequestOptions options ,
1506+ ActionListener <org .elasticsearch .action .admin .indices .template .get .GetIndexTemplatesResponse > listener ) {
1507+ restHighLevelClient .performRequestAsyncAndParseEntity (getIndexTemplatesRequest ,
1508+ IndicesRequestConverters ::getTemplatesWithDocumentTypes ,
1509+ options , org .elasticsearch .action .admin .indices .template .get .GetIndexTemplatesResponse ::fromXContent , listener , emptySet ());
1510+ }
1511+
1512+ /**
1513+ * Asynchronously gets index templates using the Index Templates API
1514+ * See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-templates.html"> Index Templates API
1515+ * on elastic.co</a>
1516+ * @param getIndexTemplatesRequest the request
1517+ * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
1518+ * @param listener the listener to be notified upon request completion
1519+ */
1520+ public void getIndexTemplateAsync (GetIndexTemplatesRequest getIndexTemplatesRequest , RequestOptions options ,
14411521 ActionListener <GetIndexTemplatesResponse > listener ) {
1442- restHighLevelClient .performRequestAsyncAndParseEntity (getIndexTemplatesRequest , IndicesRequestConverters ::getTemplates ,
1522+ restHighLevelClient .performRequestAsyncAndParseEntity (getIndexTemplatesRequest ,
1523+ IndicesRequestConverters ::getTemplates ,
14431524 options , GetIndexTemplatesResponse ::fromXContent , listener , emptySet ());
1444- }
1525+ }
14451526
14461527 /**
14471528 * Uses the Index Templates API to determine if index templates exist
0 commit comments