Skip to content

Commit 9141e64

Browse files
committed
Fix invalid selector message.
1 parent 07f629e commit 9141e64

File tree

2 files changed

+5
-15
lines changed

2 files changed

+5
-15
lines changed

server/src/main/java/org/elasticsearch/cluster/metadata/IndexNameExpressionResolver.java

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2132,20 +2132,10 @@ private static <V> V splitSelectorExpression(String expression, BiFunction<Strin
21322132
String suffix = expression.substring(lastDoubleColon + SELECTOR_SEPARATOR.length());
21332133
IndexComponentSelector selector = IndexComponentSelector.getByKey(suffix);
21342134
if (selector == null) {
2135-
// Do some work to surface a helpful error message for likely errors
2136-
if (Regex.isSimpleMatchPattern(suffix)) {
2137-
throw new InvalidIndexNameException(
2138-
expression,
2139-
"Invalid usage of :: separator, ["
2140-
+ suffix
2141-
+ "] contains a wildcard, but only the match all wildcard [*] is supported in a selector"
2142-
);
2143-
} else {
2144-
throw new InvalidIndexNameException(
2145-
expression,
2146-
"Invalid usage of :: separator, [" + suffix + "] is not a recognized selector"
2147-
);
2148-
}
2135+
throw new InvalidIndexNameException(
2136+
expression,
2137+
"invalid usage of :: separator, [" + suffix + "] is not a recognized selector"
2138+
);
21492139
}
21502140
String expressionBase = expression.substring(0, lastDoubleColon);
21512141
ensureNoMoreSelectorSeparators(expressionBase, expression);

server/src/test/java/org/elasticsearch/action/admin/indices/rollover/RolloverRequestTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ public void testValidation() {
253253
assertNotNull(validationException);
254254
assertEquals(1, validationException.validationErrors().size());
255255
assertEquals(
256-
"rollover cannot be applied to both regular and failure indices at the same time",
256+
"Invalid index name [alias-index::*], invalid usage of :: separator, [*] is not a recognized selector",
257257
validationException.validationErrors().get(0)
258258
);
259259
}

0 commit comments

Comments
 (0)