44
44
import org .elasticsearch .action .admin .indices .shrink .ResizeRequest ;
45
45
import org .elasticsearch .action .admin .indices .shrink .ResizeResponse ;
46
46
import org .elasticsearch .action .admin .indices .template .delete .DeleteIndexTemplateRequest ;
47
- import org .elasticsearch .action .admin .indices .template .get .GetIndexTemplatesResponse ;
48
- import org .elasticsearch .action .admin .indices .template .put .PutIndexTemplateRequest ;
49
47
import org .elasticsearch .action .admin .indices .validate .query .ValidateQueryRequest ;
50
48
import org .elasticsearch .action .admin .indices .validate .query .ValidateQueryResponse ;
51
49
import org .elasticsearch .action .support .master .AcknowledgedResponse ;
60
58
import org .elasticsearch .client .indices .GetIndexTemplatesRequest ;
61
59
import org .elasticsearch .client .indices .GetMappingsRequest ;
62
60
import org .elasticsearch .client .indices .GetMappingsResponse ;
61
+ import org .elasticsearch .client .indices .GetIndexTemplatesResponse ;
63
62
import org .elasticsearch .client .indices .IndexTemplatesExistRequest ;
63
+ import org .elasticsearch .client .indices .PutIndexTemplateRequest ;
64
64
import org .elasticsearch .client .indices .PutMappingRequest ;
65
65
import org .elasticsearch .client .indices .UnfreezeIndexRequest ;
66
66
import org .elasticsearch .client .indices .rollover .RolloverRequest ;
@@ -1471,6 +1471,7 @@ public void putSettingsAsync(UpdateSettingsRequest updateSettingsRequest, Reques
1471
1471
AcknowledgedResponse ::fromXContent , listener , emptySet ());
1472
1472
}
1473
1473
1474
+
1474
1475
/**
1475
1476
* Asynchronously updates specific index level settings using the Update Indices Settings API.
1476
1477
* <p>
@@ -1493,9 +1494,13 @@ public void putSettingsAsync(UpdateSettingsRequest updateSettingsRequest, Action
1493
1494
* @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
1494
1495
* @return the response
1495
1496
* @throws IOException in case there is a problem sending the request or parsing back the response
1497
+ * @deprecated This old form of request allows types in mappings. Use {@link #putTemplate(PutIndexTemplateRequest, RequestOptions)}
1498
+ * instead which introduces a new request object without types.
1496
1499
*/
1497
- public AcknowledgedResponse putTemplate (PutIndexTemplateRequest putIndexTemplateRequest ,
1498
- RequestOptions options ) throws IOException {
1500
+ @ Deprecated
1501
+ public AcknowledgedResponse putTemplate (
1502
+ org .elasticsearch .action .admin .indices .template .put .PutIndexTemplateRequest putIndexTemplateRequest ,
1503
+ RequestOptions options ) throws IOException {
1499
1504
return restHighLevelClient .performRequestAndParseEntity (putIndexTemplateRequest , IndicesRequestConverters ::putTemplate , options ,
1500
1505
AcknowledgedResponse ::fromXContent , emptySet ());
1501
1506
}
@@ -1507,9 +1512,44 @@ public AcknowledgedResponse putTemplate(PutIndexTemplateRequest putIndexTemplate
1507
1512
* @param putIndexTemplateRequest the request
1508
1513
* @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
1509
1514
* @param listener the listener to be notified upon request completion
1515
+ * @deprecated This old form of request allows types in mappings.
1516
+ * Use {@link #putTemplateAsync(PutIndexTemplateRequest, RequestOptions, ActionListener)}
1517
+ * instead which introduces a new request object without types.
1510
1518
*/
1511
- public void putTemplateAsync (PutIndexTemplateRequest putIndexTemplateRequest , RequestOptions options ,
1512
- ActionListener <AcknowledgedResponse > listener ) {
1519
+ @ Deprecated
1520
+ public void putTemplateAsync (org .elasticsearch .action .admin .indices .template .put .PutIndexTemplateRequest putIndexTemplateRequest ,
1521
+ RequestOptions options , ActionListener <AcknowledgedResponse > listener ) {
1522
+ restHighLevelClient .performRequestAsyncAndParseEntity (putIndexTemplateRequest , IndicesRequestConverters ::putTemplate , options ,
1523
+ AcknowledgedResponse ::fromXContent , listener , emptySet ());
1524
+ }
1525
+
1526
+
1527
+ /**
1528
+ * Puts an index template using the Index Templates API.
1529
+ * See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-templates.html"> Index Templates API
1530
+ * on elastic.co</a>
1531
+ * @param putIndexTemplateRequest the request
1532
+ * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
1533
+ * @return the response
1534
+ * @throws IOException in case there is a problem sending the request or parsing back the response
1535
+ */
1536
+ public AcknowledgedResponse putTemplate (
1537
+ PutIndexTemplateRequest putIndexTemplateRequest ,
1538
+ RequestOptions options ) throws IOException {
1539
+ return restHighLevelClient .performRequestAndParseEntity (putIndexTemplateRequest , IndicesRequestConverters ::putTemplate , options ,
1540
+ AcknowledgedResponse ::fromXContent , emptySet ());
1541
+ }
1542
+
1543
+ /**
1544
+ * Asynchronously puts an index template using the Index Templates API.
1545
+ * See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-templates.html"> Index Templates API
1546
+ * on elastic.co</a>
1547
+ * @param putIndexTemplateRequest the request
1548
+ * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
1549
+ * @param listener the listener to be notified upon request completion
1550
+ */
1551
+ public void putTemplateAsync (PutIndexTemplateRequest putIndexTemplateRequest ,
1552
+ RequestOptions options , ActionListener <AcknowledgedResponse > listener ) {
1513
1553
restHighLevelClient .performRequestAsyncAndParseEntity (putIndexTemplateRequest , IndicesRequestConverters ::putTemplate , options ,
1514
1554
AcknowledgedResponse ::fromXContent , listener , emptySet ());
1515
1555
}
@@ -1545,33 +1585,74 @@ public void validateQueryAsync(ValidateQueryRequest validateQueryRequest, Reques
1545
1585
}
1546
1586
1547
1587
/**
1548
- * Gets index templates using the Index Templates API
1588
+ * Gets index templates using the Index Templates API. The mappings will be returned in a legacy deprecated format, where the
1589
+ * mapping definition is nested under the type name.
1549
1590
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-templates.html"> Index Templates API
1550
1591
* on elastic.co</a>
1551
1592
* @param getIndexTemplatesRequest the request
1552
1593
* @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
1553
1594
* @return the response
1554
1595
* @throws IOException in case there is a problem sending the request or parsing back the response
1596
+ * @deprecated This method uses an old response object which still refers to types, a deprecated feature. Use
1597
+ * {@link #getIndexTemplate(GetIndexTemplatesRequest, RequestOptions)} instead which returns a new response object
1555
1598
*/
1556
- public GetIndexTemplatesResponse getTemplate (GetIndexTemplatesRequest getIndexTemplatesRequest ,
1557
- RequestOptions options ) throws IOException {
1558
- return restHighLevelClient .performRequestAndParseEntity (getIndexTemplatesRequest , IndicesRequestConverters ::getTemplates ,
1559
- options , GetIndexTemplatesResponse ::fromXContent , emptySet ());
1599
+ @ Deprecated
1600
+ public org .elasticsearch .action .admin .indices .template .get .GetIndexTemplatesResponse getTemplate (
1601
+ GetIndexTemplatesRequest getIndexTemplatesRequest , RequestOptions options ) throws IOException {
1602
+ return restHighLevelClient .performRequestAndParseEntity (getIndexTemplatesRequest ,
1603
+ IndicesRequestConverters ::getTemplatesWithDocumentTypes ,
1604
+ options , org .elasticsearch .action .admin .indices .template .get .GetIndexTemplatesResponse ::fromXContent , emptySet ());
1560
1605
}
1606
+
1607
+ /**
1608
+ * Gets index templates using the Index Templates API
1609
+ * See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-templates.html"> Index Templates API
1610
+ * on elastic.co</a>
1611
+ * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
1612
+ * @param getIndexTemplatesRequest the request
1613
+ * @return the response
1614
+ * @throws IOException in case there is a problem sending the request or parsing back the response
1615
+ */
1616
+ public GetIndexTemplatesResponse getIndexTemplate (GetIndexTemplatesRequest getIndexTemplatesRequest , RequestOptions options )
1617
+ throws IOException {
1618
+ return restHighLevelClient .performRequestAndParseEntity (getIndexTemplatesRequest ,
1619
+ IndicesRequestConverters ::getTemplates ,
1620
+ options , GetIndexTemplatesResponse ::fromXContent , emptySet ());
1621
+ }
1561
1622
1562
1623
/**
1563
- * Asynchronously gets index templates using the Index Templates API
1624
+ * Asynchronously gets index templates using the Index Templates API. The mappings will be returned in a legacy deprecated format,
1625
+ * where the mapping definition is nested under the type name.
1564
1626
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-templates.html"> Index Templates API
1565
1627
* on elastic.co</a>
1566
1628
* @param getIndexTemplatesRequest the request
1567
1629
* @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
1568
1630
* @param listener the listener to be notified upon request completion
1631
+ * @deprecated This method uses an old response object which still refers to types, a deprecated feature. Use
1632
+ * {@link #getIndexTemplateAsync(GetIndexTemplatesRequest, RequestOptions, ActionListener)} instead which returns a new response object
1569
1633
*/
1634
+ @ Deprecated
1570
1635
public void getTemplateAsync (GetIndexTemplatesRequest getIndexTemplatesRequest , RequestOptions options ,
1636
+ ActionListener <org .elasticsearch .action .admin .indices .template .get .GetIndexTemplatesResponse > listener ) {
1637
+ restHighLevelClient .performRequestAsyncAndParseEntity (getIndexTemplatesRequest ,
1638
+ IndicesRequestConverters ::getTemplatesWithDocumentTypes ,
1639
+ options , org .elasticsearch .action .admin .indices .template .get .GetIndexTemplatesResponse ::fromXContent , listener , emptySet ());
1640
+ }
1641
+
1642
+ /**
1643
+ * Asynchronously gets index templates using the Index Templates API
1644
+ * See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-templates.html"> Index Templates API
1645
+ * on elastic.co</a>
1646
+ * @param getIndexTemplatesRequest the request
1647
+ * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
1648
+ * @param listener the listener to be notified upon request completion
1649
+ */
1650
+ public void getIndexTemplateAsync (GetIndexTemplatesRequest getIndexTemplatesRequest , RequestOptions options ,
1571
1651
ActionListener <GetIndexTemplatesResponse > listener ) {
1572
- restHighLevelClient .performRequestAsyncAndParseEntity (getIndexTemplatesRequest , IndicesRequestConverters ::getTemplates ,
1652
+ restHighLevelClient .performRequestAsyncAndParseEntity (getIndexTemplatesRequest ,
1653
+ IndicesRequestConverters ::getTemplates ,
1573
1654
options , GetIndexTemplatesResponse ::fromXContent , listener , emptySet ());
1574
- }
1655
+ }
1575
1656
1576
1657
/**
1577
1658
* Uses the Index Templates API to determine if index templates exist
0 commit comments