Skip to content

Commit 4267b8f

Browse files
authored
Improve the deprecation messages around include_type_name. (#38052)
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.
1 parent e30f6cc commit 4267b8f

File tree

5 files changed

+16
-15
lines changed

5 files changed

+16
-15
lines changed

server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestCreateIndexAction.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ public class RestCreateIndexAction extends BaseRestHandler {
4242
private static final DeprecationLogger deprecationLogger = new DeprecationLogger(
4343
LogManager.getLogger(RestPutMappingAction.class));
4444
public static final String TYPES_DEPRECATION_MESSAGE = "[types removal] Specifying types in create index " +
45-
"requests is deprecated. The parameter include_type_name should be provided and set to false to be " +
46-
"compatible with the next major version.";
45+
"requests is deprecated. To be compatible with 7.0, the mapping definition should not be nested under " +
46+
"the type name, and the parameter include_type_name must be provided and set to false.";
4747

4848
public RestCreateIndexAction(Settings settings, RestController controller) {
4949
super(settings);

server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetFieldMappingAction.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@ public class RestGetFieldMappingAction extends BaseRestHandler {
4848

4949
private static final DeprecationLogger deprecationLogger = new DeprecationLogger(
5050
LogManager.getLogger(RestGetFieldMappingAction.class));
51-
public static final String TYPES_DEPRECATION_MESSAGE = "[types removal] Specifying types in get field mapping " +
52-
"requests is deprecated. The parameter include_type_name should be provided and set to false to be " +
53-
"compatible with the next major version.";
51+
public static final String TYPES_DEPRECATION_MESSAGE = "[types removal] The response format of get field " +
52+
"mapping requests will change in 7.0. Please start using the include_type_name parameter set to false " +
53+
"to move to the new, typeless response format that will become the default.";
5454

5555
public RestGetFieldMappingAction(Settings settings, RestController controller) {
5656
super(settings);

server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetIndicesAction.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,11 @@
4646
*/
4747
public class RestGetIndicesAction extends BaseRestHandler {
4848

49-
private static final DeprecationLogger deprecationLogger = new DeprecationLogger(LogManager.getLogger(RestGetIndicesAction.class));
50-
static final String TYPES_DEPRECATION_MESSAGE = "[types removal] The response format of get indices requests will change in "
51-
+ "the next major version. Please start using the `include_type_name` parameter set to `false` in the request to "
52-
+ "move to the new, typeless response format that will be the default in 7.0.";
49+
private static final DeprecationLogger deprecationLogger = new DeprecationLogger(
50+
LogManager.getLogger(RestGetIndicesAction.class));
51+
static final String TYPES_DEPRECATION_MESSAGE = "[types removal] The response format of get indices requests " +
52+
"will change in 7.0. Please start using the include_type_name parameter set to false to move to the new, " +
53+
"typeless response format that will become the default.";
5354

5455
private static final Set<String> allowedResponseParameters = Collections
5556
.unmodifiableSet(Stream.concat(Collections.singleton(INCLUDE_TYPE_NAME_PARAMETER).stream(), Settings.FORMAT_PARAMS.stream())

server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetMappingAction.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,9 @@
5959
public class RestGetMappingAction extends BaseRestHandler {
6060
private static final Logger logger = LogManager.getLogger(RestGetMappingAction.class);
6161
private static final DeprecationLogger deprecationLogger = new DeprecationLogger(logger);
62-
public static final String TYPES_DEPRECATION_MESSAGE = "[types removal] Using include_type_name in get" +
63-
" mapping requests is deprecated. The parameter will be removed in the next major version.";
64-
62+
public static final String TYPES_DEPRECATION_MESSAGE = "[types removal] The response format of get mapping " +
63+
"requests will change in 7.0. Please start using the include_type_name parameter set to false to " +
64+
"move to the new, typeless response format that will become the default.";
6565

6666
public RestGetMappingAction(final Settings settings, final RestController controller) {
6767
super(settings);

server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestPutMappingAction.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@
4141
public class RestPutMappingAction extends BaseRestHandler {
4242
private static final DeprecationLogger deprecationLogger = new DeprecationLogger(
4343
LogManager.getLogger(RestPutMappingAction.class));
44-
public static final String TYPES_DEPRECATION_MESSAGE = "[types removal] Specifying types in put mapping " +
45-
"requests is deprecated. The parameter include_type_name should be provided and set to false to be " +
46-
"compatible with the next major version.";
44+
public static final String TYPES_DEPRECATION_MESSAGE = "[types removal] Specifying types in create index " +
45+
"requests is deprecated. To be compatible with 7.0, the mapping definition should not be nested under " +
46+
"the type name, and the parameter include_type_name must be provided and set to false.";
4747

4848
public RestPutMappingAction(Settings settings, RestController controller) {
4949
super(settings);

0 commit comments

Comments
 (0)