Removed redundant JSON object from Put Mapping docs (#28514)
This commit is contained in:
parent
974ad680f5
commit
ee00523737
|
@ -411,19 +411,21 @@ public class IndicesClientDocumentationIT extends ESRestHighLevelClientTestCase
|
|||
request.type("tweet"); // <2>
|
||||
// end::put-mapping-request
|
||||
|
||||
{
|
||||
// tag::put-mapping-request-source
|
||||
request.source(
|
||||
"{\n" +
|
||||
" \"tweet\": {\n" +
|
||||
" \"properties\": {\n" +
|
||||
" \"message\": {\n" +
|
||||
" \"type\": \"text\"\n" +
|
||||
" }\n" +
|
||||
" }\n" +
|
||||
" }\n" +
|
||||
"}", // <1>
|
||||
XContentType.JSON);
|
||||
// end::put-mapping-request-source
|
||||
PutMappingResponse putMappingResponse = client.indices().putMapping(request);
|
||||
assertTrue(putMappingResponse.isAcknowledged());
|
||||
}
|
||||
|
||||
{
|
||||
//tag::put-mapping-map
|
||||
|
@ -432,9 +434,7 @@ public class IndicesClientDocumentationIT extends ESRestHighLevelClientTestCase
|
|||
message.put("type", "text");
|
||||
Map<String, Object> properties = new HashMap<>();
|
||||
properties.put("message", message);
|
||||
Map<String, Object> tweet = new HashMap<>();
|
||||
tweet.put("properties", properties);
|
||||
jsonMap.put("tweet", tweet);
|
||||
jsonMap.put("properties", properties);
|
||||
request.source(jsonMap); // <1>
|
||||
//end::put-mapping-map
|
||||
PutMappingResponse putMappingResponse = client.indices().putMapping(request);
|
||||
|
@ -444,8 +444,6 @@ public class IndicesClientDocumentationIT extends ESRestHighLevelClientTestCase
|
|||
//tag::put-mapping-xcontent
|
||||
XContentBuilder builder = XContentFactory.jsonBuilder();
|
||||
builder.startObject();
|
||||
{
|
||||
builder.startObject("tweet");
|
||||
{
|
||||
builder.startObject("properties");
|
||||
{
|
||||
|
@ -458,8 +456,6 @@ public class IndicesClientDocumentationIT extends ESRestHighLevelClientTestCase
|
|||
builder.endObject();
|
||||
}
|
||||
builder.endObject();
|
||||
}
|
||||
builder.endObject();
|
||||
request.source(builder); // <1>
|
||||
//end::put-mapping-xcontent
|
||||
PutMappingResponse putMappingResponse = client.indices().putMapping(request);
|
||||
|
|
Loading…
Reference in New Issue