Skip to content

Commit e6f873c

Browse files
authored
Remove feature parsing for GetIndicesAction (#28535)
Removes dead code. Follow-up of #24723
1 parent c8df446 commit e6f873c

File tree

1 file changed

+4
-34
lines changed

1 file changed

+4
-34
lines changed

server/src/main/java/org/elasticsearch/action/admin/indices/get/GetIndexRequest.java

Lines changed: 4 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@
3434
*/
3535
public class GetIndexRequest extends ClusterInfoRequest<GetIndexRequest> {
3636
public enum Feature {
37-
ALIASES((byte) 0, "_aliases", "_alias"),
38-
MAPPINGS((byte) 1, "_mappings", "_mapping"),
39-
SETTINGS((byte) 2, "_settings");
37+
ALIASES((byte) 0),
38+
MAPPINGS((byte) 1),
39+
SETTINGS((byte) 2);
4040

4141
private static final Feature[] FEATURES = new Feature[Feature.values().length];
4242

@@ -47,52 +47,22 @@ public enum Feature {
4747
}
4848
}
4949

50-
private final List<String> validNames;
51-
private final String preferredName;
5250
private final byte id;
5351

54-
Feature(byte id, String... validNames) {
55-
assert validNames != null && validNames.length > 0;
52+
Feature(byte id) {
5653
this.id = id;
57-
this.validNames = Arrays.asList(validNames);
58-
this.preferredName = validNames[0];
5954
}
6055

6156
public byte id() {
6257
return id;
6358
}
6459

65-
public String preferredName() {
66-
return preferredName;
67-
}
68-
69-
public boolean validName(String name) {
70-
return this.validNames.contains(name);
71-
}
72-
73-
public static Feature fromName(String name) {
74-
for (Feature feature : Feature.values()) {
75-
if (feature.validName(name)) {
76-
return feature;
77-
}
78-
}
79-
throw new IllegalArgumentException("No endpoint or operation is available at [" + name + "]");
80-
}
81-
8260
public static Feature fromId(byte id) {
8361
if (id < 0 || id >= FEATURES.length) {
8462
throw new IllegalArgumentException("No mapping for id [" + id + "]");
8563
}
8664
return FEATURES[id];
8765
}
88-
89-
public static Feature[] convertToFeatures(String... featureNames) {
90-
Feature[] features = new Feature[featureNames.length];
91-
for (int i = 0; i < featureNames.length; i++) {
92-
features[i] = Feature.fromName(featureNames[i]);
93-
}
94-
return features;
95-
}
9666
}
9767

9868
private static final Feature[] DEFAULT_FEATURES = new Feature[] { Feature.ALIASES, Feature.MAPPINGS, Feature.SETTINGS };

0 commit comments

Comments
 (0)