|
|
@@ -19,12 +19,15 @@
|
|
|
|
|
|
package org.elasticsearch.rest.action.admin.indices;
|
|
|
|
|
|
+import org.apache.logging.log4j.LogManager;
|
|
|
+import org.apache.logging.log4j.Logger;
|
|
|
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.GetFieldMappingsResponse.FieldMappingMetadata;
|
|
|
import org.elasticsearch.action.support.IndicesOptions;
|
|
|
import org.elasticsearch.client.node.NodeClient;
|
|
|
import org.elasticsearch.common.Strings;
|
|
|
+import org.elasticsearch.common.logging.DeprecationLogger;
|
|
|
import org.elasticsearch.common.xcontent.XContentBuilder;
|
|
|
import org.elasticsearch.rest.BaseRestHandler;
|
|
|
import org.elasticsearch.rest.BytesRestResponse;
|
|
|
@@ -43,6 +46,10 @@ import static org.elasticsearch.rest.RestStatus.OK;
|
|
|
|
|
|
public class RestGetFieldMappingAction extends BaseRestHandler {
|
|
|
|
|
|
+ private static final Logger logger = LogManager.getLogger(RestGetFieldMappingAction.class);
|
|
|
+ private static final DeprecationLogger deprecationLogger = new DeprecationLogger(logger);
|
|
|
+
|
|
|
+
|
|
|
@Override
|
|
|
public List<Route> routes() {
|
|
|
return List.of(
|
|
|
@@ -63,6 +70,12 @@ public class RestGetFieldMappingAction extends BaseRestHandler {
|
|
|
GetFieldMappingsRequest getMappingsRequest = new GetFieldMappingsRequest();
|
|
|
getMappingsRequest.indices(indices).fields(fields).includeDefaults(request.paramAsBoolean("include_defaults", false));
|
|
|
getMappingsRequest.indicesOptions(IndicesOptions.fromRequest(request, getMappingsRequest.indicesOptions()));
|
|
|
+
|
|
|
+ if (request.hasParam("local")) {
|
|
|
+ deprecationLogger.deprecatedAndMaybeLog("get_field_mapping_local",
|
|
|
+ "Use [local] in get field mapping requests is deprecated. "
|
|
|
+ + "The parameter will be removed in the next major version");
|
|
|
+ }
|
|
|
getMappingsRequest.local(request.paramAsBoolean("local", getMappingsRequest.local()));
|
|
|
return channel ->
|
|
|
client.admin().indices().getFieldMappings(getMappingsRequest, new RestBuilderListener<>(channel) {
|