Skip to content

Commit 2432e67

Browse files
committed
Remove TODO in IndexNameExpressionResolver
This commit removes a TODO in the IndexNameExpressionResolver that indicated the API should use a Set instead of a List. However, this TODO was not completely correct since the ordering of arguments matters due to negations when evaluating wildcards and since we also allow a list of patterns like `*,-foo,*`, which would have a different meaning even when using a Set with insertion ordering. Relates elastic#52788
1 parent dd33193 commit 2432e67

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -680,8 +680,6 @@ public List<String> resolve(Context context, List<String> expressions) {
680680
return resolveEmptyOrTrivialWildcard(options, metaData);
681681
}
682682

683-
// TODO: Fix API to work with sets rather than lists since we need to convert to sets
684-
// internally anyway.
685683
Set<String> result = innerResolve(context, expressions, options, metaData);
686684

687685
if (result == null) {

server/src/test/java/org/elasticsearch/cluster/metadata/IndexNameExpressionResolverTests.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,10 @@ public void testIndexOptionsWildcardExpansion() {
351351
assertEquals(1, results.length);
352352
assertEquals("bar", results[0]);
353353

354+
results = indexNameExpressionResolver.concreteIndexNames(context, "*", "-foo", "*");
355+
assertEquals(3, results.length);
356+
assertThat(results, arrayContainingInAnyOrder("bar", "foobar", "foo"));
357+
354358
results = indexNameExpressionResolver.concreteIndexNames(context, "-*");
355359
assertEquals(0, results.length);
356360

0 commit comments

Comments
 (0)