diff --git a/core/src/main/java/org/elasticsearch/cluster/metadata/IndexNameExpressionResolver.java b/core/src/main/java/org/elasticsearch/cluster/metadata/IndexNameExpressionResolver.java index 0841dd3c6bf..8a3d53a1d12 100644 --- a/core/src/main/java/org/elasticsearch/cluster/metadata/IndexNameExpressionResolver.java +++ b/core/src/main/java/org/elasticsearch/cluster/metadata/IndexNameExpressionResolver.java @@ -29,8 +29,6 @@ import org.elasticsearch.common.collect.Tuple; import org.elasticsearch.common.component.AbstractComponent; import org.elasticsearch.common.joda.DateMathParser; import org.elasticsearch.common.joda.FormatDateTimeFormatter; -import org.elasticsearch.common.logging.DeprecationLogger; -import org.elasticsearch.common.logging.Loggers; import org.elasticsearch.common.regex.Regex; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.index.Index; @@ -58,8 +56,6 @@ public class IndexNameExpressionResolver extends AbstractComponent { private final List expressionResolvers; private final DateMathExpressionResolver dateMathExpressionResolver; - private static final DeprecationLogger DEPRECATION_LOGGER = - new DeprecationLogger(Loggers.getLogger(IndexNameExpressionResolver.class)); public IndexNameExpressionResolver(Settings settings) { super(settings); @@ -592,7 +588,6 @@ public class IndexNameExpressionResolver extends AbstractComponent { private Set innerResolve(Context context, List expressions, IndicesOptions options, MetaData metaData) { Set result = null; boolean wildcardSeen = false; - boolean plusSeen = false; for (int i = 0; i < expressions.size(); i++) { String expression = expressions.get(i); if (aliasOrIndexExists(metaData, expression)) { @@ -605,14 +600,7 @@ public class IndexNameExpressionResolver extends AbstractComponent { throw infe(expression); } boolean add = true; - if (expression.charAt(0) == '+') { - // if its the first, add empty result set - plusSeen = true; - if (i == 0) { - result = new HashSet<>(); - } - expression = expression.substring(1); - } else if (expression.charAt(0) == '-') { + if (expression.charAt(0) == '-') { // if there is a negation without a wildcard being previously seen, add it verbatim, // otherwise return the expression if (wildcardSeen) { @@ -655,9 +643,6 @@ public class IndexNameExpressionResolver extends AbstractComponent { wildcardSeen = true; } } - if (plusSeen) { - DEPRECATION_LOGGER.deprecated("support for '+' as part of index expressions is deprecated"); - } return result; } diff --git a/core/src/test/java/org/elasticsearch/cluster/metadata/IndexNameExpressionResolverTests.java b/core/src/test/java/org/elasticsearch/cluster/metadata/IndexNameExpressionResolverTests.java index 3a5d3d938e9..4ad4de495ca 100644 --- a/core/src/test/java/org/elasticsearch/cluster/metadata/IndexNameExpressionResolverTests.java +++ b/core/src/test/java/org/elasticsearch/cluster/metadata/IndexNameExpressionResolverTests.java @@ -1027,24 +1027,6 @@ public class IndexNameExpressionResolverTests extends ESTestCase { assertArrayEquals(new String[] {"test-alias-0", "test-alias-1", "test-alias-non-filtering"}, strings); } - public void testConcreteIndicesForDeprecatedPattern() { - MetaData.Builder mdBuilder = MetaData.builder() - .put(indexBuilder("testXXX").state(State.OPEN)) - .put(indexBuilder("testXXY").state(State.OPEN)) - .put(indexBuilder("testYYY").state(State.OPEN)); - ClusterState state = ClusterState.builder(new ClusterName("_name")).metaData(mdBuilder).build(); - - IndexNameExpressionResolver.Context context = new IndexNameExpressionResolver.Context(state, - IndicesOptions.fromOptions(true, true, true, true)); - assertThat(newHashSet(indexNameExpressionResolver.concreteIndexNames(context, "+testX*")), - equalTo(newHashSet("testXXX", "testXXY"))); - assertThat(newHashSet(indexNameExpressionResolver.concreteIndexNames(context, "+testXXX", "+testXXY", "+testYYY", "-testYYY")), - equalTo(newHashSet("testXXX", "testXXY", "testYYY"))); - assertThat(newHashSet(indexNameExpressionResolver.concreteIndexNames(context, "+testXX*", "+testY*")), - equalTo(newHashSet("testXXX", "testXXY", "testYYY"))); - assertWarnings("support for '+' as part of index expressions is deprecated"); - } - public void testDeleteIndexIgnoresAliases() { MetaData.Builder mdBuilder = MetaData.builder() .put(indexBuilder("test-index").state(State.OPEN) diff --git a/core/src/test/java/org/elasticsearch/cluster/metadata/WildcardExpressionResolverTests.java b/core/src/test/java/org/elasticsearch/cluster/metadata/WildcardExpressionResolverTests.java index 3c8b540f45c..e918f2acd4f 100644 --- a/core/src/test/java/org/elasticsearch/cluster/metadata/WildcardExpressionResolverTests.java +++ b/core/src/test/java/org/elasticsearch/cluster/metadata/WildcardExpressionResolverTests.java @@ -182,20 +182,4 @@ public class WildcardExpressionResolverTests extends ESTestCase { private IndexMetaData.Builder indexBuilder(String index) { return IndexMetaData.builder(index).settings(settings(Version.CURRENT).put(IndexMetaData.SETTING_NUMBER_OF_SHARDS, 1).put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, 0)); } - - public void testForDeprecatedPlusPattern() { - MetaData.Builder mdBuilder = MetaData.builder() - .put(indexBuilder("testXXX").state(IndexMetaData.State.OPEN)) - .put(indexBuilder("testXYY").state(IndexMetaData.State.OPEN)) - .put(indexBuilder("testYYY").state(IndexMetaData.State.OPEN)); - ClusterState state = ClusterState.builder(new ClusterName("_name")).metaData(mdBuilder).build(); - IndexNameExpressionResolver.WildcardExpressionResolver resolver = new IndexNameExpressionResolver.WildcardExpressionResolver(); - - IndexNameExpressionResolver.Context context = new IndexNameExpressionResolver.Context(state, IndicesOptions.fromOptions(true, true, true, true)); - assertThat(newHashSet(resolver.resolve(context, Arrays.asList("+testX*", "-testYYY"))), equalTo(newHashSet("testXXX", "testXYY"))); - assertThat(newHashSet(resolver.resolve(context, Arrays.asList("+testYYY", "+testXY*"))), equalTo(newHashSet("testYYY", "testXYY"))); - assertThat(newHashSet(resolver.resolve(context, Arrays.asList("testYYY", "+testXX*"))), equalTo(newHashSet("testXXX", "testYYY"))); - assertWarnings("support for '+' as part of index expressions is deprecated"); - } - } diff --git a/docs/reference/api-conventions.asciidoc b/docs/reference/api-conventions.asciidoc index 7176f885831..2493988b783 100644 --- a/docs/reference/api-conventions.asciidoc +++ b/docs/reference/api-conventions.asciidoc @@ -20,8 +20,8 @@ API, unless otherwise specified. Most APIs that refer to an `index` parameter support execution across multiple indices, using simple `test1,test2,test3` notation (or `_all` for all indices). It also -support wildcards, for example: `test*` or `*test` or `te*t` or `*test*`, and the ability to "add" (`+`) -and "remove" (`-`), for example: `+test*,-test3`. +support wildcards, for example: `test*` or `*test` or `te*t` or `*test*`, and the +ability to "exclude" (`-`), for example: `test*,-test3`. All multi indices API support the following url query string parameters: diff --git a/docs/reference/migration/migrate_6_0/indices.asciidoc b/docs/reference/migration/migrate_6_0/indices.asciidoc index b0be942a418..3c1c0379144 100644 --- a/docs/reference/migration/migrate_6_0/indices.asciidoc +++ b/docs/reference/migration/migrate_6_0/indices.asciidoc @@ -62,3 +62,9 @@ which will expand to matching indices). The index parameter in the delete index API no longer accepts alias names. Instead, it accepts only index names (or wildcards which will expand to matching indices). + +==== Support for '+' has been removed in index expressions + +Omitting the '+' has the same effect as specifying it, hence support for '+' +has been removed in index expressions. +