From 3e584632561fa27d392ddc1923ffff5b896e54b7 Mon Sep 17 00:00:00 2001 From: Nhat Nguyen Date: Sun, 6 May 2018 15:44:57 -0400 Subject: [PATCH] DOCS: Correct mapping tags in put-template api The mapping tags were not named consistently and not linked correctly. Relates #30400 --- .../IndicesClientDocumentationIT.java | 16 ++++++++-------- .../high-level/indices/put_template.asciidoc | 8 ++++---- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/client/rest-high-level/src/test/java/org/elasticsearch/client/documentation/IndicesClientDocumentationIT.java b/client/rest-high-level/src/test/java/org/elasticsearch/client/documentation/IndicesClientDocumentationIT.java index ad2a030a2a6..1dd9834d8f5 100644 --- a/client/rest-high-level/src/test/java/org/elasticsearch/client/documentation/IndicesClientDocumentationIT.java +++ b/client/rest-high-level/src/test/java/org/elasticsearch/client/documentation/IndicesClientDocumentationIT.java @@ -1621,7 +1621,7 @@ public class IndicesClientDocumentationIT extends ESRestHighLevelClientTestCase // end::put-template-request-settings { - // tag::create-put-template-request-mappings + // tag::put-template-request-mappings-json request.mapping("tweet", // <1> "{\n" + " \"tweet\": {\n" + @@ -1633,11 +1633,11 @@ public class IndicesClientDocumentationIT extends ESRestHighLevelClientTestCase " }\n" + "}", // <2> XContentType.JSON); - // end::create-put-template-mappings + // end::put-template-request-mappings-json assertTrue(client.indices().putTemplate(request).isAcknowledged()); } { - //tag::put-template-mappings-map + //tag::put-template-request-mappings-map Map jsonMap = new HashMap<>(); Map message = new HashMap<>(); message.put("type", "text"); @@ -1647,11 +1647,11 @@ public class IndicesClientDocumentationIT extends ESRestHighLevelClientTestCase tweet.put("properties", properties); jsonMap.put("tweet", tweet); request.mapping("tweet", jsonMap); // <1> - //end::put-template-mappings-map + //end::put-template-request-mappings-map assertTrue(client.indices().putTemplate(request).isAcknowledged()); } { - //tag::put-template-mappings-xcontent + //tag::put-template-request-mappings-xcontent XContentBuilder builder = XContentFactory.jsonBuilder(); builder.startObject(); { @@ -1671,13 +1671,13 @@ public class IndicesClientDocumentationIT extends ESRestHighLevelClientTestCase } builder.endObject(); request.mapping("tweet", builder); // <1> - //end::put-template-mappings-xcontent + //end::put-template-request-mappings-xcontent assertTrue(client.indices().putTemplate(request).isAcknowledged()); } { - //tag::put-template-mappings-shortcut + //tag::put-template-request-mappings-shortcut request.mapping("tweet", "message", "type=text"); // <1> - //end::put-template-mappings-shortcut + //end::put-template-request-mappings-shortcut assertTrue(client.indices().putTemplate(request).isAcknowledged()); } diff --git a/docs/java-rest/high-level/indices/put_template.asciidoc b/docs/java-rest/high-level/indices/put_template.asciidoc index 57409feece6..7f0f3a1fee7 100644 --- a/docs/java-rest/high-level/indices/put_template.asciidoc +++ b/docs/java-rest/high-level/indices/put_template.asciidoc @@ -31,7 +31,7 @@ template's patterns. ["source","java",subs="attributes,callouts,macros"] -------------------------------------------------- -include-tagged::{doc-tests}/IndicesClientDocumentationIT.java[put-template-request-mappings] +include-tagged::{doc-tests}/IndicesClientDocumentationIT.java[put-template-request-mappings-json] -------------------------------------------------- <1> The type to define <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 ["source","java",subs="attributes,callouts,macros"] -------------------------------------------------- -include-tagged::{doc-tests}/IndicesClientDocumentationIT.java[put-template-mappings-map] +include-tagged::{doc-tests}/IndicesClientDocumentationIT.java[put-template-request-mappings-map] -------------------------------------------------- <1> Mapping source provided as a `Map` which gets automatically converted to JSON format ["source","java",subs="attributes,callouts,macros"] -------------------------------------------------- -include-tagged::{doc-tests}/IndicesClientDocumentationIT.java[put-template-mappings-xcontent] +include-tagged::{doc-tests}/IndicesClientDocumentationIT.java[put-template-request-mappings-xcontent] -------------------------------------------------- <1> Mapping source provided as an `XContentBuilder` object, the Elasticsearch built-in helpers to generate JSON content ["source","java",subs="attributes,callouts,macros"] -------------------------------------------------- -include-tagged::{doc-tests}/IndicesClientDocumentationIT.java[put-template-mappings-shortcut] +include-tagged::{doc-tests}/IndicesClientDocumentationIT.java[put-template-request-mappings-shortcut] -------------------------------------------------- <1> Mapping source provided as `Object` key-pairs, which gets converted to JSON format