From a41ebc2b0b2a3ec1c3172518cf29a0b927a7a0c5 Mon Sep 17 00:00:00 2001 From: Julie Tibshirani Date: Wed, 30 Jan 2019 12:16:12 -0800 Subject: [PATCH 1/2] Improve the deprecation messages around include_type_name. This PR standardizes the message across the different indices APIs and makes sure to mention that mappings should no longer be nested under the type name. --- .../rest/action/admin/indices/RestCreateIndexAction.java | 4 ++-- .../action/admin/indices/RestGetFieldMappingAction.java | 6 +++--- .../rest/action/admin/indices/RestGetIndicesAction.java | 9 +++++---- .../rest/action/admin/indices/RestGetMappingAction.java | 6 +++--- .../rest/action/admin/indices/RestPutMappingAction.java | 6 +++--- 5 files changed, 16 insertions(+), 15 deletions(-) diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestCreateIndexAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestCreateIndexAction.java index 24046dbbed6c6..82a81c883d054 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestCreateIndexAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestCreateIndexAction.java @@ -42,8 +42,8 @@ public class RestCreateIndexAction extends BaseRestHandler { private static final DeprecationLogger deprecationLogger = new DeprecationLogger( LogManager.getLogger(RestPutMappingAction.class)); public static final String TYPES_DEPRECATION_MESSAGE = "[types removal] Specifying types in create index " + - "requests is deprecated. The parameter include_type_name should be provided and set to false to be " + - "compatible with the next major version."; + "requests is deprecated. To be compatible with 7.0, the mapping definition should not nested under the " + + "type name, and the parameter include_type_name must be provided and set to false."; public RestCreateIndexAction(Settings settings, RestController controller) { super(settings); diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetFieldMappingAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetFieldMappingAction.java index 86292cc81aee9..02d9010d0490e 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetFieldMappingAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetFieldMappingAction.java @@ -48,9 +48,9 @@ public class RestGetFieldMappingAction extends BaseRestHandler { private static final DeprecationLogger deprecationLogger = new DeprecationLogger( LogManager.getLogger(RestGetFieldMappingAction.class)); - public static final String TYPES_DEPRECATION_MESSAGE = "[types removal] Specifying types in get field mapping " + - "requests is deprecated. The parameter include_type_name should be provided and set to false to be " + - "compatible with the next major version."; + public static final String TYPES_DEPRECATION_MESSAGE = "[types removal] The response format of get field " + + "mapping requests will change in 7.0. Please start using the include_type_name parameter set to false " + + "to move to the new, typeless response format that will become the default."; public RestGetFieldMappingAction(Settings settings, RestController controller) { super(settings); diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetIndicesAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetIndicesAction.java index 33263be937459..a2a539e8a8d6c 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetIndicesAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetIndicesAction.java @@ -46,10 +46,11 @@ */ public class RestGetIndicesAction extends BaseRestHandler { - private static final DeprecationLogger deprecationLogger = new DeprecationLogger(LogManager.getLogger(RestGetIndicesAction.class)); - static final String TYPES_DEPRECATION_MESSAGE = "[types removal] The response format of get indices requests will change in " - + "the next major version. Please start using the `include_type_name` parameter set to `false` in the request to " - + "move to the new, typeless response format that will be the default in 7.0."; + private static final DeprecationLogger deprecationLogger = new DeprecationLogger( + LogManager.getLogger(RestGetIndicesAction.class)); + static final String TYPES_DEPRECATION_MESSAGE = "[types removal] The response format of get indices requests " + + "will change in 7.0. Please start using the include_type_name parameter set to false to move to the new, " + + "typeless response format that will become the default."; private static final Set allowedResponseParameters = Collections .unmodifiableSet(Stream.concat(Collections.singleton(INCLUDE_TYPE_NAME_PARAMETER).stream(), Settings.FORMAT_PARAMS.stream()) diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetMappingAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetMappingAction.java index cd7d82c9e465c..12a5807eeed56 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetMappingAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetMappingAction.java @@ -59,9 +59,9 @@ public class RestGetMappingAction extends BaseRestHandler { private static final Logger logger = LogManager.getLogger(RestGetMappingAction.class); private static final DeprecationLogger deprecationLogger = new DeprecationLogger(logger); - public static final String TYPES_DEPRECATION_MESSAGE = "[types removal] Using include_type_name in get" + - " mapping requests is deprecated. The parameter will be removed in the next major version."; - + public static final String TYPES_DEPRECATION_MESSAGE = "[types removal] The response format of get index " + + "template requests will change in 7.0. Please start using the include_type_name parameter set to false to " + + "move to the new, typeless response format that will become the default."; public RestGetMappingAction(final Settings settings, final RestController controller) { super(settings); diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestPutMappingAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestPutMappingAction.java index 5c5565916098f..39fbef6f30c56 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestPutMappingAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestPutMappingAction.java @@ -41,9 +41,9 @@ public class RestPutMappingAction extends BaseRestHandler { private static final DeprecationLogger deprecationLogger = new DeprecationLogger( LogManager.getLogger(RestPutMappingAction.class)); - public static final String TYPES_DEPRECATION_MESSAGE = "[types removal] Specifying types in put mapping " + - "requests is deprecated. The parameter include_type_name should be provided and set to false to be " + - "compatible with the next major version."; + public static final String TYPES_DEPRECATION_MESSAGE = "[types removal] Specifying types in create index " + + "requests is deprecated. To be compatible with 7.0, the mapping definition should not nested under the " + + "type name, and the parameter include_type_name must be provided and set to false."; public RestPutMappingAction(Settings settings, RestController controller) { super(settings); From dc096ac301acd85b55287c5fea1812a647ea5dbe Mon Sep 17 00:00:00 2001 From: Julie Tibshirani Date: Thu, 31 Jan 2019 09:50:35 -0800 Subject: [PATCH 2/2] Fix typos in messages. --- .../rest/action/admin/indices/RestCreateIndexAction.java | 4 ++-- .../rest/action/admin/indices/RestGetMappingAction.java | 4 ++-- .../rest/action/admin/indices/RestPutMappingAction.java | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestCreateIndexAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestCreateIndexAction.java index 82a81c883d054..064137edb4ceb 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestCreateIndexAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestCreateIndexAction.java @@ -42,8 +42,8 @@ public class RestCreateIndexAction extends BaseRestHandler { private static final DeprecationLogger deprecationLogger = new DeprecationLogger( LogManager.getLogger(RestPutMappingAction.class)); public static final String TYPES_DEPRECATION_MESSAGE = "[types removal] Specifying types in create index " + - "requests is deprecated. To be compatible with 7.0, the mapping definition should not nested under the " + - "type name, and the parameter include_type_name must be provided and set to false."; + "requests is deprecated. To be compatible with 7.0, the mapping definition should not be nested under " + + "the type name, and the parameter include_type_name must be provided and set to false."; public RestCreateIndexAction(Settings settings, RestController controller) { super(settings); diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetMappingAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetMappingAction.java index 12a5807eeed56..e8b4603bd4fb0 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetMappingAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetMappingAction.java @@ -59,8 +59,8 @@ public class RestGetMappingAction extends BaseRestHandler { private static final Logger logger = LogManager.getLogger(RestGetMappingAction.class); private static final DeprecationLogger deprecationLogger = new DeprecationLogger(logger); - public static final String TYPES_DEPRECATION_MESSAGE = "[types removal] The response format of get index " + - "template requests will change in 7.0. Please start using the include_type_name parameter set to false to " + + public static final String TYPES_DEPRECATION_MESSAGE = "[types removal] The response format of get mapping " + + "requests will change in 7.0. Please start using the include_type_name parameter set to false to " + "move to the new, typeless response format that will become the default."; public RestGetMappingAction(final Settings settings, final RestController controller) { diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestPutMappingAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestPutMappingAction.java index 39fbef6f30c56..f5c171fe70765 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestPutMappingAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestPutMappingAction.java @@ -42,8 +42,8 @@ public class RestPutMappingAction extends BaseRestHandler { private static final DeprecationLogger deprecationLogger = new DeprecationLogger( LogManager.getLogger(RestPutMappingAction.class)); public static final String TYPES_DEPRECATION_MESSAGE = "[types removal] Specifying types in create index " + - "requests is deprecated. To be compatible with 7.0, the mapping definition should not nested under the " + - "type name, and the parameter include_type_name must be provided and set to false."; + "requests is deprecated. To be compatible with 7.0, the mapping definition should not be nested under " + + "the type name, and the parameter include_type_name must be provided and set to false."; public RestPutMappingAction(Settings settings, RestController controller) { super(settings);