diff --git a/client/rest-high-level/src/main/java/org/elasticsearch/client/IndicesClient.java b/client/rest-high-level/src/main/java/org/elasticsearch/client/IndicesClient.java
index 30a42eb333f4a..28a9cc2036673 100644
--- a/client/rest-high-level/src/main/java/org/elasticsearch/client/IndicesClient.java
+++ b/client/rest-high-level/src/main/java/org/elasticsearch/client/IndicesClient.java
@@ -37,6 +37,8 @@
import org.elasticsearch.action.admin.indices.forcemerge.ForceMergeRequest;
import org.elasticsearch.action.admin.indices.forcemerge.ForceMergeResponse;
import org.elasticsearch.action.admin.indices.get.GetIndexRequest;
+import org.elasticsearch.action.admin.indices.mapping.get.GetFieldMappingsRequest;
+import org.elasticsearch.action.admin.indices.mapping.get.GetFieldMappingsResponse;
import org.elasticsearch.action.admin.indices.mapping.get.GetMappingsRequest;
import org.elasticsearch.action.admin.indices.mapping.get.GetMappingsResponse;
import org.elasticsearch.action.admin.indices.mapping.put.PutMappingRequest;
@@ -188,6 +190,35 @@ public void getMappingsAsync(GetMappingsRequest getMappingsRequest, RequestOptio
GetMappingsResponse::fromXContent, listener, emptySet());
}
+ /**
+ * Retrieves the field mappings on an index or indices using the Get Field Mapping API.
+ * See
+ * Get Field Mapping API on elastic.co
+ * @param getFieldMappingsRequest the request
+ * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
+ * @return the response
+ * @throws IOException in case there is a problem sending the request or parsing back the response
+ */
+ public GetFieldMappingsResponse getFieldMapping(GetFieldMappingsRequest getFieldMappingsRequest,
+ RequestOptions options) throws IOException {
+ return restHighLevelClient.performRequestAndParseEntity(getFieldMappingsRequest, RequestConverters::getFieldMapping, options,
+ GetFieldMappingsResponse::fromXContent, emptySet());
+ }
+
+ /**
+ * Asynchronously retrieves the field mappings on an index on indices using the Get Field Mapping API.
+ * See
+ * Get Field Mapping API on elastic.co
+ * @param getFieldMappingsRequest the request
+ * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
+ * @param listener the listener to be notified upon request completion
+ */
+ public void getFieldMappingAsync(GetFieldMappingsRequest getFieldMappingsRequest, RequestOptions options,
+ ActionListener listener) {
+ restHighLevelClient.performRequestAsyncAndParseEntity(getFieldMappingsRequest, RequestConverters::getFieldMapping, options,
+ GetFieldMappingsResponse::fromXContent, listener, emptySet());
+ }
+
/**
* Updates aliases using the Index Aliases API.
* See
diff --git a/client/rest-high-level/src/main/java/org/elasticsearch/client/RequestConverters.java b/client/rest-high-level/src/main/java/org/elasticsearch/client/RequestConverters.java
index cd67bc8e48325..62a69815f5579 100644
--- a/client/rest-high-level/src/main/java/org/elasticsearch/client/RequestConverters.java
+++ b/client/rest-high-level/src/main/java/org/elasticsearch/client/RequestConverters.java
@@ -50,6 +50,7 @@
import org.elasticsearch.action.admin.indices.flush.SyncedFlushRequest;
import org.elasticsearch.action.admin.indices.forcemerge.ForceMergeRequest;
import org.elasticsearch.action.admin.indices.get.GetIndexRequest;
+import org.elasticsearch.action.admin.indices.mapping.get.GetFieldMappingsRequest;
import org.elasticsearch.action.admin.indices.mapping.get.GetMappingsRequest;
import org.elasticsearch.action.admin.indices.mapping.put.PutMappingRequest;
import org.elasticsearch.action.admin.indices.open.OpenIndexRequest;
@@ -229,6 +230,25 @@ static Request getMappings(GetMappingsRequest getMappingsRequest) throws IOExcep
return request;
}
+ static Request getFieldMapping(GetFieldMappingsRequest getFieldMappingsRequest) throws IOException {
+ String[] indices = getFieldMappingsRequest.indices() == null ? Strings.EMPTY_ARRAY : getFieldMappingsRequest.indices();
+ String[] types = getFieldMappingsRequest.types() == null ? Strings.EMPTY_ARRAY : getFieldMappingsRequest.types();
+ String[] fields = getFieldMappingsRequest.fields() == null ? Strings.EMPTY_ARRAY : getFieldMappingsRequest.fields();
+
+ String endpoint = new EndpointBuilder().addCommaSeparatedPathParts(indices)
+ .addPathPartAsIs("_mapping").addCommaSeparatedPathParts(types)
+ .addPathPartAsIs("field").addCommaSeparatedPathParts(fields)
+ .build();
+
+ Request request = new Request(HttpGet.METHOD_NAME, endpoint);
+
+ Params parameters = new Params(request);
+ parameters.withIndicesOptions(getFieldMappingsRequest.indicesOptions());
+ parameters.withIncludeDefaults(getFieldMappingsRequest.includeDefaults());
+ parameters.withLocal(getFieldMappingsRequest.local());
+ return request;
+ }
+
static Request refresh(RefreshRequest refreshRequest) {
String[] indices = refreshRequest.indices() == null ? Strings.EMPTY_ARRAY : refreshRequest.indices();
Request request = new Request(HttpPost.METHOD_NAME, endpoint(indices, "_refresh"));
diff --git a/client/rest-high-level/src/test/java/org/elasticsearch/client/IndicesClientIT.java b/client/rest-high-level/src/test/java/org/elasticsearch/client/IndicesClientIT.java
index c226b5349267c..5f8e6b5d36526 100644
--- a/client/rest-high-level/src/test/java/org/elasticsearch/client/IndicesClientIT.java
+++ b/client/rest-high-level/src/test/java/org/elasticsearch/client/IndicesClientIT.java
@@ -43,6 +43,8 @@
import org.elasticsearch.action.admin.indices.forcemerge.ForceMergeRequest;
import org.elasticsearch.action.admin.indices.forcemerge.ForceMergeResponse;
import org.elasticsearch.action.admin.indices.get.GetIndexRequest;
+import org.elasticsearch.action.admin.indices.mapping.get.GetFieldMappingsRequest;
+import org.elasticsearch.action.admin.indices.mapping.get.GetFieldMappingsResponse;
import org.elasticsearch.action.admin.indices.mapping.get.GetMappingsRequest;
import org.elasticsearch.action.admin.indices.mapping.get.GetMappingsResponse;
import org.elasticsearch.action.admin.indices.mapping.put.PutMappingRequest;
@@ -74,6 +76,7 @@
import org.elasticsearch.cluster.metadata.IndexMetaData;
import org.elasticsearch.cluster.metadata.IndexTemplateMetaData;
import org.elasticsearch.common.ValidationException;
+import org.elasticsearch.common.bytes.BytesArray;
import org.elasticsearch.common.settings.Setting;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.unit.ByteSizeUnit;
@@ -378,6 +381,41 @@ public void testGetMapping() throws IOException {
assertThat(mappings, equalTo(expected));
}
+ public void testGetFieldMapping() throws IOException {
+ String indexName = "test";
+ createIndex(indexName, Settings.EMPTY);
+
+ PutMappingRequest putMappingRequest = new PutMappingRequest(indexName);
+ putMappingRequest.type("_doc");
+ XContentBuilder mappingBuilder = JsonXContent.contentBuilder();
+ mappingBuilder.startObject().startObject("properties").startObject("field");
+ mappingBuilder.field("type", "text");
+ mappingBuilder.endObject().endObject().endObject();
+ putMappingRequest.source(mappingBuilder);
+
+ PutMappingResponse putMappingResponse =
+ execute(putMappingRequest, highLevelClient().indices()::putMapping, highLevelClient().indices()::putMappingAsync);
+ assertTrue(putMappingResponse.isAcknowledged());
+
+ GetFieldMappingsRequest getFieldMappingsRequest = new GetFieldMappingsRequest()
+ .indices(indexName)
+ .types("_doc")
+ .fields("field");
+
+ GetFieldMappingsResponse getFieldMappingsResponse =
+ execute(getFieldMappingsRequest,
+ highLevelClient().indices()::getFieldMapping,
+ highLevelClient().indices()::getFieldMappingAsync);
+
+ final Map fieldMappingMap =
+ getFieldMappingsResponse.mappings().get(indexName).get("_doc");
+
+ final GetFieldMappingsResponse.FieldMappingMetaData metaData =
+ new GetFieldMappingsResponse.FieldMappingMetaData("field",
+ new BytesArray("{\"field\":{\"type\":\"text\"}}"));
+ assertThat(fieldMappingMap, equalTo(Collections.singletonMap("field", metaData)));
+ }
+
public void testDeleteIndex() throws IOException {
{
// Delete index if exists
diff --git a/client/rest-high-level/src/test/java/org/elasticsearch/client/RequestConvertersTests.java b/client/rest-high-level/src/test/java/org/elasticsearch/client/RequestConvertersTests.java
index eee37cea561b0..14441c5b4e461 100644
--- a/client/rest-high-level/src/test/java/org/elasticsearch/client/RequestConvertersTests.java
+++ b/client/rest-high-level/src/test/java/org/elasticsearch/client/RequestConvertersTests.java
@@ -52,6 +52,7 @@
import org.elasticsearch.action.admin.indices.flush.SyncedFlushRequest;
import org.elasticsearch.action.admin.indices.forcemerge.ForceMergeRequest;
import org.elasticsearch.action.admin.indices.get.GetIndexRequest;
+import org.elasticsearch.action.admin.indices.mapping.get.GetFieldMappingsRequest;
import org.elasticsearch.action.admin.indices.mapping.get.GetMappingsRequest;
import org.elasticsearch.action.admin.indices.mapping.put.PutMappingRequest;
import org.elasticsearch.action.admin.indices.open.OpenIndexRequest;
@@ -456,6 +457,61 @@ public void testGetMapping() throws IOException {
assertThat(HttpGet.METHOD_NAME, equalTo(request.getMethod()));
}
+ public void testGetFieldMapping() throws IOException {
+ GetFieldMappingsRequest getFieldMappingsRequest = new GetFieldMappingsRequest();
+
+ String[] indices = Strings.EMPTY_ARRAY;
+ if (randomBoolean()) {
+ indices = randomIndicesNames(0, 5);
+ getFieldMappingsRequest.indices(indices);
+ } else if (randomBoolean()) {
+ getFieldMappingsRequest.indices((String[]) null);
+ }
+
+ String type = null;
+ if (randomBoolean()) {
+ type = randomAlphaOfLengthBetween(3, 10);
+ getFieldMappingsRequest.types(type);
+ } else if (randomBoolean()) {
+ getFieldMappingsRequest.types((String[]) null);
+ }
+
+ String[] fields = null;
+ if (randomBoolean()) {
+ fields = new String[randomIntBetween(1, 5)];
+ for (int i = 0; i < fields.length; i++) {
+ fields[i] = randomAlphaOfLengthBetween(3, 10);
+ }
+ getFieldMappingsRequest.fields(fields);
+ } else if (randomBoolean()) {
+ getFieldMappingsRequest.fields((String[]) null);
+ }
+
+ Map expectedParams = new HashMap<>();
+
+ setRandomIndicesOptions(getFieldMappingsRequest::indicesOptions, getFieldMappingsRequest::indicesOptions, expectedParams);
+ setRandomLocal(getFieldMappingsRequest::local, expectedParams);
+
+ Request request = RequestConverters.getFieldMapping(getFieldMappingsRequest);
+ StringJoiner endpoint = new StringJoiner("/", "/", "");
+ String index = String.join(",", indices);
+ if (Strings.hasLength(index)) {
+ endpoint.add(index);
+ }
+ endpoint.add("_mapping");
+ if (type != null) {
+ endpoint.add(type);
+ }
+ endpoint.add("field");
+ if (fields != null) {
+ endpoint.add(String.join(",", fields));
+ }
+ assertThat(endpoint.toString(), equalTo(request.getEndpoint()));
+
+ assertThat(expectedParams, equalTo(request.getParameters()));
+ assertThat(HttpGet.METHOD_NAME, equalTo(request.getMethod()));
+ }
+
public void testDeleteIndex() {
String[] indices = randomIndicesNames(0, 5);
DeleteIndexRequest deleteIndexRequest = new DeleteIndexRequest(indices);
@@ -2239,16 +2295,20 @@ private static void setRandomHumanReadable(GetIndexRequest request, Map request, Map expectedParams) {
+ private static void setRandomLocal(Consumer setter, Map expectedParams) {
if (randomBoolean()) {
boolean local = randomBoolean();
- request.local(local);
+ setter.accept(local);
if (local) {
expectedParams.put("local", String.valueOf(local));
}
}
}
+ private static void setRandomLocal(MasterNodeReadRequest> request, Map expectedParams) {
+ setRandomLocal(request::local, expectedParams);
+ }
+
private static void setRandomTimeout(Consumer setter, TimeValue defaultTimeout, Map expectedParams) {
if (randomBoolean()) {
String timeout = randomTimeValue();
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 9cc28152d03e3..95fa7f7185b5b 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
@@ -41,6 +41,8 @@
import org.elasticsearch.action.admin.indices.forcemerge.ForceMergeRequest;
import org.elasticsearch.action.admin.indices.forcemerge.ForceMergeResponse;
import org.elasticsearch.action.admin.indices.get.GetIndexRequest;
+import org.elasticsearch.action.admin.indices.mapping.get.GetFieldMappingsRequest;
+import org.elasticsearch.action.admin.indices.mapping.get.GetFieldMappingsResponse;
import org.elasticsearch.action.admin.indices.mapping.get.GetMappingsRequest;
import org.elasticsearch.action.admin.indices.mapping.get.GetMappingsResponse;
import org.elasticsearch.action.admin.indices.mapping.put.PutMappingRequest;
@@ -703,6 +705,110 @@ public void onFailure(Exception e) {
}
}
+ public void testGetFieldMapping() throws IOException, InterruptedException {
+ RestHighLevelClient client = highLevelClient();
+
+ {
+ CreateIndexResponse createIndexResponse = client.indices().create(new CreateIndexRequest("twitter"), RequestOptions.DEFAULT);
+ assertTrue(createIndexResponse.isAcknowledged());
+ PutMappingRequest request = new PutMappingRequest("twitter");
+ request.type("tweet");
+ request.source(
+ "{\n" +
+ " \"properties\": {\n" +
+ " \"message\": {\n" +
+ " \"type\": \"text\"\n" +
+ " },\n" +
+ " \"timestamp\": {\n" +
+ " \"type\": \"date\"\n" +
+ " }\n" +
+ " }\n" +
+ "}", // <1>
+ XContentType.JSON);
+ PutMappingResponse putMappingResponse = client.indices().putMapping(request, RequestOptions.DEFAULT);
+ assertTrue(putMappingResponse.isAcknowledged());
+ }
+
+ // tag::get-field-mapping-request
+ GetFieldMappingsRequest request = new GetFieldMappingsRequest(); // <1>
+ request.indices("twitter"); // <2>
+ request.types("tweet"); // <3>
+ request.fields("message", "timestamp"); // <4>
+ // end::get-field-mapping-request
+
+ // tag::get-field-mapping-request-indicesOptions
+ request.indicesOptions(IndicesOptions.lenientExpandOpen()); // <1>
+ // end::get-field-mapping-request-indicesOptions
+
+ // tag::get-field-mapping-request-local
+ request.local(true); // <1>
+ // end::get-field-mapping-request-local
+
+ {
+
+ // tag::get-field-mapping-execute
+ GetFieldMappingsResponse response =
+ client.indices().getFieldMapping(request, RequestOptions.DEFAULT);
+ // end::get-field-mapping-execute
+
+ // tag::get-field-mapping-response
+ final Map>> mappings =
+ response.mappings();// <1>
+ final Map typeMappings =
+ mappings.get("twitter").get("tweet"); // <2>
+ final GetFieldMappingsResponse.FieldMappingMetaData metaData =
+ typeMappings.get("message");// <3>
+
+ final String fullName = metaData.fullName();// <4>
+ final Map source = metaData.sourceAsMap(); // <5>
+ // end::get-field-mapping-response
+ }
+
+ {
+ // tag::get-field-mapping-execute-listener
+ ActionListener listener =
+ new ActionListener() {
+ @Override
+ public void onResponse(GetFieldMappingsResponse putMappingResponse) {
+ // <1>
+ }
+
+ @Override
+ public void onFailure(Exception e) {
+ // <2>
+ }
+ };
+ // end::get-field-mapping-execute-listener
+
+ // Replace the empty listener by a blocking listener in test
+ final CountDownLatch latch = new CountDownLatch(1);
+ final ActionListener latchListener = new LatchedActionListener<>(listener, latch);
+ listener = ActionListener.wrap(r -> {
+ final Map>> mappings =
+ r.mappings();
+ final Map typeMappings =
+ mappings.get("twitter").get("tweet");
+ final GetFieldMappingsResponse.FieldMappingMetaData metaData1 = typeMappings.get("message");
+
+ final String fullName = metaData1.fullName();
+ final Map source = metaData1.sourceAsMap();
+ latchListener.onResponse(r);
+ }, e -> {
+ latchListener.onFailure(e);
+ fail("should not fail");
+ });
+
+ // tag::get-field-mapping-execute-async
+ client.indices().getFieldMappingAsync(request, RequestOptions.DEFAULT, listener); // <1>
+ // end::get-field-mapping-execute-async
+
+ assertTrue(latch.await(30L, TimeUnit.SECONDS));
+ }
+
+
+ }
+
+
public void testOpenIndex() throws Exception {
RestHighLevelClient client = highLevelClient();
diff --git a/docs/java-rest/high-level/indices/get_field_mappings.asciidoc b/docs/java-rest/high-level/indices/get_field_mappings.asciidoc
new file mode 100644
index 0000000000000..3f5ff5aec6449
--- /dev/null
+++ b/docs/java-rest/high-level/indices/get_field_mappings.asciidoc
@@ -0,0 +1,86 @@
+[[java-rest-high-get-field-mappings]]
+=== Get Field Mappings API
+
+[[java-rest-high-get-field-mappings-request]]
+==== Get Field Mappings Request
+
+A `GetFieldMappingsRequest` can have an optional list of indices, optional list of types and the list of fields:
+
+["source","java",subs="attributes,callouts,macros"]
+--------------------------------------------------
+include-tagged::{doc-tests}/IndicesClientDocumentationIT.java[get-field-mapping-request]
+--------------------------------------------------
+<1> An empty request
+<2> Setting the indices to fetch mapping for
+<3> The types to be returned
+<4> The fields to be returned
+
+==== Optional arguments
+The following arguments can also optionally be provided:
+
+["source","java",subs="attributes,callouts,macros"]
+--------------------------------------------------
+include-tagged::{doc-tests}/IndicesClientDocumentationIT.java[get-field-mapping-request-indicesOptions]
+--------------------------------------------------
+<1> Setting `IndicesOptions` controls how unavailable indices are resolved and
+how wildcard expressions are expanded
+
+["source","java",subs="attributes,callouts,macros"]
+--------------------------------------------------
+include-tagged::{doc-tests}/IndicesClientDocumentationIT.java[get-field-mapping-request-local]
+--------------------------------------------------
+<1> The `local` flag (defaults to `false`) controls whether the aliases need
+to be looked up in the local cluster state or in the cluster state held by
+the elected master node
+
+[[java-rest-high-get-field-mappings-sync]]
+==== Synchronous Execution
+
+["source","java",subs="attributes,callouts,macros"]
+--------------------------------------------------
+include-tagged::{doc-tests}/IndicesClientDocumentationIT.java[get-field-mapping-execute]
+--------------------------------------------------
+
+[[java-rest-high-get-field-mapping-async]]
+==== Asynchronous Execution
+
+The asynchronous execution of a get mappings request requires both the
+`GetFieldMappingsRequest` instance and an `ActionListener` instance to be passed to
+the asynchronous method:
+
+["source","java",subs="attributes,callouts,macros"]
+--------------------------------------------------
+include-tagged::{doc-tests}/IndicesClientDocumentationIT.java[get-field-mapping-execute-async]
+--------------------------------------------------
+<1> The `GetFieldMappingsRequest` to execute and the `ActionListener` to use when the execution completes
+
+The asynchronous method does not block and returns immediately. Once it is
+completed the `ActionListener` is called back using the `onResponse` method if
+the execution successfully completed or using the `onFailure` method if it
+failed.
+
+A typical listener for `GetMappingsResponse` looks like:
+
+["source","java",subs="attributes,callouts,macros"]
+--------------------------------------------------
+include-tagged::{doc-tests}/IndicesClientDocumentationIT.java[get-field-mapping-execute-listener]
+--------------------------------------------------
+<1> Called when the execution is successfully completed. The response is provided as an argument
+<2> Called in case of failure. The raised exception is provided as an argument
+
+[[java-rest-high-get-field-mapping-response]]
+==== Get Field Mappings Response
+
+The returned `GetFieldMappingsResponse` allows to retrieve information about the
+executed operation as follows:
+
+["source","java",subs="attributes,callouts,macros"]
+--------------------------------------------------
+include-tagged::{doc-tests}/IndicesClientDocumentationIT.java[get-field-mapping-response]
+--------------------------------------------------
+<1> Returning all requested indices fields' mappings
+<2> Retrieving the mappings for a particular index and type
+<3> Getting the mappings metadata for the `message` field
+<4> Getting the full name of the field
+<5> Getting the mapping source of the field
+
diff --git a/docs/java-rest/high-level/supported-apis.asciidoc b/docs/java-rest/high-level/supported-apis.asciidoc
index 727088aa5737f..3caab5100ca0f 100644
--- a/docs/java-rest/high-level/supported-apis.asciidoc
+++ b/docs/java-rest/high-level/supported-apis.asciidoc
@@ -77,6 +77,7 @@ Index Management::
Mapping Management::
* <>
+* <>
Alias Management::
* <>
@@ -98,6 +99,7 @@ include::indices/force_merge.asciidoc[]
include::indices/rollover.asciidoc[]
include::indices/put_mapping.asciidoc[]
include::indices/get_mappings.asciidoc[]
+include::indices/get_field_mappings.asciidoc[]
include::indices/update_aliases.asciidoc[]
include::indices/exists_alias.asciidoc[]
include::indices/get_alias.asciidoc[]
diff --git a/server/src/main/java/org/elasticsearch/action/admin/indices/mapping/get/GetFieldMappingsResponse.java b/server/src/main/java/org/elasticsearch/action/admin/indices/mapping/get/GetFieldMappingsResponse.java
index d837c1cbd199b..81b9812d61c5f 100644
--- a/server/src/main/java/org/elasticsearch/action/admin/indices/mapping/get/GetFieldMappingsResponse.java
+++ b/server/src/main/java/org/elasticsearch/action/admin/indices/mapping/get/GetFieldMappingsResponse.java
@@ -20,13 +20,17 @@
package org.elasticsearch.action.admin.indices.mapping.get;
import org.elasticsearch.action.ActionResponse;
+import org.elasticsearch.common.ParseField;
import org.elasticsearch.common.bytes.BytesArray;
import org.elasticsearch.common.bytes.BytesReference;
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;
+import org.elasticsearch.common.xcontent.ConstructingObjectParser;
+import org.elasticsearch.common.xcontent.ObjectParser;
import org.elasticsearch.common.xcontent.ToXContentFragment;
import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentHelper;
+import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.common.xcontent.XContentType;
import org.elasticsearch.index.mapper.Mapper;
@@ -34,13 +38,45 @@
import java.io.InputStream;
import java.util.HashMap;
import java.util.Map;
+import java.util.Objects;
import static java.util.Collections.emptyMap;
import static java.util.Collections.unmodifiableMap;
+import static org.elasticsearch.common.xcontent.ConstructingObjectParser.optionalConstructorArg;
+import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder;
+import static org.elasticsearch.common.xcontent.XContentParserUtils.ensureExpectedToken;
/** Response object for {@link GetFieldMappingsRequest} API */
public class GetFieldMappingsResponse extends ActionResponse implements ToXContentFragment {
+ private static final ParseField MAPPINGS = new ParseField("mappings");
+
+ private static final ObjectParser