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>
|
request.type("tweet"); // <2>
|
||||||
// end::put-mapping-request
|
// end::put-mapping-request
|
||||||
|
|
||||||
// tag::put-mapping-request-source
|
{
|
||||||
request.source(
|
// tag::put-mapping-request-source
|
||||||
"{\n" +
|
request.source(
|
||||||
" \"tweet\": {\n" +
|
"{\n" +
|
||||||
" \"properties\": {\n" +
|
" \"properties\": {\n" +
|
||||||
" \"message\": {\n" +
|
" \"message\": {\n" +
|
||||||
" \"type\": \"text\"\n" +
|
" \"type\": \"text\"\n" +
|
||||||
" }\n" +
|
" }\n" +
|
||||||
" }\n" +
|
" }\n" +
|
||||||
" }\n" +
|
"}", // <1>
|
||||||
"}", // <1>
|
XContentType.JSON);
|
||||||
XContentType.JSON);
|
// end::put-mapping-request-source
|
||||||
// end::put-mapping-request-source
|
PutMappingResponse putMappingResponse = client.indices().putMapping(request);
|
||||||
|
assertTrue(putMappingResponse.isAcknowledged());
|
||||||
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
//tag::put-mapping-map
|
//tag::put-mapping-map
|
||||||
|
@ -432,9 +434,7 @@ public class IndicesClientDocumentationIT extends ESRestHighLevelClientTestCase
|
||||||
message.put("type", "text");
|
message.put("type", "text");
|
||||||
Map<String, Object> properties = new HashMap<>();
|
Map<String, Object> properties = new HashMap<>();
|
||||||
properties.put("message", message);
|
properties.put("message", message);
|
||||||
Map<String, Object> tweet = new HashMap<>();
|
jsonMap.put("properties", properties);
|
||||||
tweet.put("properties", properties);
|
|
||||||
jsonMap.put("tweet", tweet);
|
|
||||||
request.source(jsonMap); // <1>
|
request.source(jsonMap); // <1>
|
||||||
//end::put-mapping-map
|
//end::put-mapping-map
|
||||||
PutMappingResponse putMappingResponse = client.indices().putMapping(request);
|
PutMappingResponse putMappingResponse = client.indices().putMapping(request);
|
||||||
|
@ -445,15 +445,11 @@ public class IndicesClientDocumentationIT extends ESRestHighLevelClientTestCase
|
||||||
XContentBuilder builder = XContentFactory.jsonBuilder();
|
XContentBuilder builder = XContentFactory.jsonBuilder();
|
||||||
builder.startObject();
|
builder.startObject();
|
||||||
{
|
{
|
||||||
builder.startObject("tweet");
|
builder.startObject("properties");
|
||||||
{
|
{
|
||||||
builder.startObject("properties");
|
builder.startObject("message");
|
||||||
{
|
{
|
||||||
builder.startObject("message");
|
builder.field("type", "text");
|
||||||
{
|
|
||||||
builder.field("type", "text");
|
|
||||||
}
|
|
||||||
builder.endObject();
|
|
||||||
}
|
}
|
||||||
builder.endObject();
|
builder.endObject();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue