Skip to content

Commit 2a79f4a

Browse files
authored
Add deprecation logging for comma-separated feature parsing (#25040)
* Add deprecation logging for comma-separated feature parsing This is the deprecation logging and documentation for 5.x related to #24723. It logs when a user does a request like: ``` GET /index/_alias,_mapping ```
1 parent 96e9ee7 commit 2a79f4a

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,10 @@ public RestGetIndicesAction(
7575
public RestChannelConsumer prepareRequest(final RestRequest request, final NodeClient client) throws IOException {
7676
String[] indices = Strings.splitStringByCommaToArray(request.param("index"));
7777
String[] featureParams = request.paramAsStringArray("type", null);
78+
if (featureParams != null && featureParams.length > 1) {
79+
deprecationLogger.deprecated("Requesting comma-separated features is deprecated and " +
80+
"will be removed in 6.0+, retrieve all features instead.");
81+
}
7882
// Work out if the indices is a list of features
7983
if (featureParams == null && indices.length > 0 && indices[0] != null && indices[0].startsWith("_") && !"_all".equals(indices[0])) {
8084
featureParams = indices;

docs/reference/indices/get-index.asciidoc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ all indices by using `_all` or `*` as index.
1919
[float]
2020
=== Filtering index information
2121

22+
deprecated[5.5.0, This comma-separated format is deprecated and will be removed. You can retrieve either a single feature (ie _alias) or all features]
23+
2224
The information returned by the get API can be filtered to include only specific features
2325
by specifying a comma delimited list of features in the URL:
2426

@@ -27,7 +29,7 @@ by specifying a comma delimited list of features in the URL:
2729
GET twitter/_settings,_mappings
2830
--------------------------------------------------
2931
// CONSOLE
30-
// TEST[setup:twitter]
32+
// TEST[setup:twitter warning:Requesting comma-separated features is deprecated and will be removed in 6.0+, retrieve all features instead.]
3133

3234
The above command will only return the settings and mappings for the index called `twitter`.
3335

rest-api-spec/src/main/resources/rest-api-spec/test/indices.get/10_basic.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,13 @@ setup:
7979
---
8080
"Get index infos should work for wildcards":
8181

82+
- skip:
83+
features:
84+
- warnings
85+
8286
- do:
87+
warnings:
88+
- 'Requesting comma-separated features is deprecated and will be removed in 6.0+, retrieve all features instead.'
8389
indices.get:
8490
index: test_*
8591
feature: _mapping,_settings

0 commit comments

Comments
 (0)