Skip to content

Commit 3e58463

Browse files
committed
DOCS: Correct mapping tags in put-template api
The mapping tags were not named consistently and not linked correctly. Relates #30400
1 parent a03e74d commit 3e58463

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

client/rest-high-level/src/test/java/org/elasticsearch/client/documentation/IndicesClientDocumentationIT.java

+8-8
Original file line numberDiff line numberDiff line change
@@ -1621,7 +1621,7 @@ public void testPutTemplate() throws Exception {
16211621
// end::put-template-request-settings
16221622

16231623
{
1624-
// tag::create-put-template-request-mappings
1624+
// tag::put-template-request-mappings-json
16251625
request.mapping("tweet", // <1>
16261626
"{\n" +
16271627
" \"tweet\": {\n" +
@@ -1633,11 +1633,11 @@ public void testPutTemplate() throws Exception {
16331633
" }\n" +
16341634
"}", // <2>
16351635
XContentType.JSON);
1636-
// end::create-put-template-mappings
1636+
// end::put-template-request-mappings-json
16371637
assertTrue(client.indices().putTemplate(request).isAcknowledged());
16381638
}
16391639
{
1640-
//tag::put-template-mappings-map
1640+
//tag::put-template-request-mappings-map
16411641
Map<String, Object> jsonMap = new HashMap<>();
16421642
Map<String, Object> message = new HashMap<>();
16431643
message.put("type", "text");
@@ -1647,11 +1647,11 @@ public void testPutTemplate() throws Exception {
16471647
tweet.put("properties", properties);
16481648
jsonMap.put("tweet", tweet);
16491649
request.mapping("tweet", jsonMap); // <1>
1650-
//end::put-template-mappings-map
1650+
//end::put-template-request-mappings-map
16511651
assertTrue(client.indices().putTemplate(request).isAcknowledged());
16521652
}
16531653
{
1654-
//tag::put-template-mappings-xcontent
1654+
//tag::put-template-request-mappings-xcontent
16551655
XContentBuilder builder = XContentFactory.jsonBuilder();
16561656
builder.startObject();
16571657
{
@@ -1671,13 +1671,13 @@ public void testPutTemplate() throws Exception {
16711671
}
16721672
builder.endObject();
16731673
request.mapping("tweet", builder); // <1>
1674-
//end::put-template-mappings-xcontent
1674+
//end::put-template-request-mappings-xcontent
16751675
assertTrue(client.indices().putTemplate(request).isAcknowledged());
16761676
}
16771677
{
1678-
//tag::put-template-mappings-shortcut
1678+
//tag::put-template-request-mappings-shortcut
16791679
request.mapping("tweet", "message", "type=text"); // <1>
1680-
//end::put-template-mappings-shortcut
1680+
//end::put-template-request-mappings-shortcut
16811681
assertTrue(client.indices().putTemplate(request).isAcknowledged());
16821682
}
16831683

docs/java-rest/high-level/indices/put_template.asciidoc

+4-4
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ template's patterns.
3131

3232
["source","java",subs="attributes,callouts,macros"]
3333
--------------------------------------------------
34-
include-tagged::{doc-tests}/IndicesClientDocumentationIT.java[put-template-request-mappings]
34+
include-tagged::{doc-tests}/IndicesClientDocumentationIT.java[put-template-request-mappings-json]
3535
--------------------------------------------------
3636
<1> The type to define
3737
<2> The mapping for this type, provided as a JSON string
@@ -41,21 +41,21 @@ The mapping source can be provided in different ways in addition to the
4141

4242
["source","java",subs="attributes,callouts,macros"]
4343
--------------------------------------------------
44-
include-tagged::{doc-tests}/IndicesClientDocumentationIT.java[put-template-mappings-map]
44+
include-tagged::{doc-tests}/IndicesClientDocumentationIT.java[put-template-request-mappings-map]
4545
--------------------------------------------------
4646
<1> Mapping source provided as a `Map` which gets automatically converted
4747
to JSON format
4848

4949
["source","java",subs="attributes,callouts,macros"]
5050
--------------------------------------------------
51-
include-tagged::{doc-tests}/IndicesClientDocumentationIT.java[put-template-mappings-xcontent]
51+
include-tagged::{doc-tests}/IndicesClientDocumentationIT.java[put-template-request-mappings-xcontent]
5252
--------------------------------------------------
5353
<1> Mapping source provided as an `XContentBuilder` object, the Elasticsearch
5454
built-in helpers to generate JSON content
5555

5656
["source","java",subs="attributes,callouts,macros"]
5757
--------------------------------------------------
58-
include-tagged::{doc-tests}/IndicesClientDocumentationIT.java[put-template-mappings-shortcut]
58+
include-tagged::{doc-tests}/IndicesClientDocumentationIT.java[put-template-request-mappings-shortcut]
5959
--------------------------------------------------
6060
<1> Mapping source provided as `Object` key-pairs, which gets converted to
6161
JSON format

0 commit comments

Comments
 (0)