Skip to content

Commit

Permalink
Remove indices query
Browse files Browse the repository at this point in the history
The indices query is deprecated since 5.0.0 (elastic#17710). It can now be removed in master (future 6.0 version).
  • Loading branch information
javanna committed Nov 30, 2016
1 parent 1179440 commit c85a17c
Show file tree
Hide file tree
Showing 14 changed files with 12 additions and 686 deletions.
18 changes: 2 additions & 16 deletions core/src/main/java/org/elasticsearch/index/IndexSettings.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import org.elasticsearch.cluster.metadata.IndexMetaData;
import org.elasticsearch.common.ParseFieldMatcher;
import org.elasticsearch.common.logging.Loggers;
import org.elasticsearch.common.regex.Regex;
import org.elasticsearch.common.settings.IndexScopedSettings;
import org.elasticsearch.common.settings.Setting;
import org.elasticsearch.common.settings.Setting.Property;
Expand All @@ -40,7 +39,6 @@
import java.util.concurrent.TimeUnit;
import java.util.function.Consumer;
import java.util.function.Function;
import java.util.function.Predicate;

/**
* This class encapsulates all index level settings and handles settings updates.
Expand Down Expand Up @@ -147,7 +145,6 @@ public final class IndexSettings {
private final boolean queryStringAnalyzeWildcard;
private final boolean queryStringAllowLeadingWildcard;
private final boolean defaultAllowUnmappedFields;
private final Predicate<String> indexNameMatcher;
private volatile Translog.Durability durability;
private final TimeValue syncInterval;
private volatile TimeValue refreshInterval;
Expand Down Expand Up @@ -214,7 +211,7 @@ public boolean isDefaultAllowUnmappedFields() {
* @param nodeSettings the nodes settings this index is allocated on.
*/
public IndexSettings(final IndexMetaData indexMetaData, final Settings nodeSettings) {
this(indexMetaData, nodeSettings, (index) -> Regex.simpleMatch(index, indexMetaData.getIndex().getName()), IndexScopedSettings.DEFAULT_SCOPED_SETTINGS);
this(indexMetaData, nodeSettings, IndexScopedSettings.DEFAULT_SCOPED_SETTINGS);
}

/**
Expand All @@ -223,9 +220,8 @@ public IndexSettings(final IndexMetaData indexMetaData, final Settings nodeSetti
*
* @param indexMetaData the index metadata this settings object is associated with
* @param nodeSettings the nodes settings this index is allocated on.
* @param indexNameMatcher a matcher that can resolve an expression to the index name or index alias
*/
public IndexSettings(final IndexMetaData indexMetaData, final Settings nodeSettings, final Predicate<String> indexNameMatcher, IndexScopedSettings indexScopedSettings) {
public IndexSettings(final IndexMetaData indexMetaData, final Settings nodeSettings, IndexScopedSettings indexScopedSettings) {
scopedSettings = indexScopedSettings.copy(nodeSettings, indexMetaData);
this.nodeSettings = nodeSettings;
this.settings = Settings.builder().put(nodeSettings).put(indexMetaData.getSettings()).build();
Expand All @@ -243,7 +239,6 @@ public IndexSettings(final IndexMetaData indexMetaData, final Settings nodeSetti
this.queryStringAllowLeadingWildcard = QUERY_STRING_ALLOW_LEADING_WILDCARD.get(nodeSettings);
this.parseFieldMatcher = new ParseFieldMatcher(settings);
this.defaultAllowUnmappedFields = scopedSettings.get(ALLOW_UNMAPPED);
this.indexNameMatcher = indexNameMatcher;
this.durability = scopedSettings.get(INDEX_TRANSLOG_DURABILITY_SETTING);
syncInterval = INDEX_TRANSLOG_SYNC_INTERVAL_SETTING.get(settings);
refreshInterval = scopedSettings.get(INDEX_REFRESH_INTERVAL_SETTING);
Expand All @@ -258,7 +253,6 @@ public IndexSettings(final IndexMetaData indexMetaData, final Settings nodeSetti
maxRefreshListeners = scopedSettings.get(MAX_REFRESH_LISTENERS_PER_SHARD);
maxSlicesPerScroll = scopedSettings.get(MAX_SLICES_PER_SCROLL);
this.mergePolicyConfig = new MergePolicyConfig(logger, this);
assert indexNameMatcher.test(indexMetaData.getIndex().getName());

scopedSettings.addSettingsUpdateConsumer(MergePolicyConfig.INDEX_COMPOUND_FORMAT_SETTING, mergePolicyConfig::setNoCFSRatio);
scopedSettings.addSettingsUpdateConsumer(MergePolicyConfig.INDEX_MERGE_POLICY_EXPUNGE_DELETES_ALLOWED_SETTING, mergePolicyConfig::setExpungeDeletesAllowed);
Expand All @@ -282,7 +276,6 @@ public IndexSettings(final IndexMetaData indexMetaData, final Settings nodeSetti
scopedSettings.addSettingsUpdateConsumer(INDEX_REFRESH_INTERVAL_SETTING, this::setRefreshInterval);
scopedSettings.addSettingsUpdateConsumer(MAX_REFRESH_LISTENERS_PER_SHARD, this::setMaxRefreshListeners);
scopedSettings.addSettingsUpdateConsumer(MAX_SLICES_PER_SCROLL, this::setMaxSlicesPerScroll);

}

private void setTranslogFlushThresholdSize(ByteSizeValue byteSizeValue) {
Expand Down Expand Up @@ -400,13 +393,6 @@ public Settings getNodeSettings() {
*/
public ParseFieldMatcher getParseFieldMatcher() { return parseFieldMatcher; }

/**
* Returns <code>true</code> if the given expression matches the index name or one of it's aliases
*/
public boolean matchesIndexName(String expression) {
return indexNameMatcher.test(expression);
}

/**
* Updates the settings and index metadata and notifies all registered settings consumers with the new settings iff at least one setting has changed.
*
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -585,18 +585,6 @@ public static TermsQueryBuilder termsQuery(String name, Collection<?> values) {
return new TermsQueryBuilder(name, values);
}

/**
* A query that will execute the wrapped query only for the specified
* indices, and "match_all" when it does not match those indices.
*
* @deprecated instead search on the `_index` field
*/
@Deprecated
public static IndicesQueryBuilder indicesQuery(QueryBuilder queryBuilder, String... indices) {
// TODO remove this method in 6.0
return new IndicesQueryBuilder(queryBuilder, indices);
}

/**
* A Query builder which allows building a query thanks to a JSON string or binary data.
*/
Expand Down
Loading

0 comments on commit c85a17c

Please sign in to comment.