|
@@ -129,6 +129,15 @@ public final class IndexSettings {
|
|
|
public static final Setting<Integer> MAX_ANALYZED_OFFSET_SETTING =
|
|
|
Setting.intSetting("index.highlight.max_analyzed_offset", 10000, 1, Property.Dynamic, Property.IndexScope);
|
|
|
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Index setting describing the maximum number of terms that can be used in Terms Query.
|
|
|
+ * The default maximum of 65536 terms is defensive, as extra processing and memory is involved
|
|
|
+ * for each additional term, and a large number of terms degrade the cluster performance.
|
|
|
+ */
|
|
|
+ public static final Setting<Integer> MAX_TERMS_COUNT_SETTING =
|
|
|
+ Setting.intSetting("index.max_terms_count", 65536, 1, Property.Dynamic, Property.IndexScope);
|
|
|
+
|
|
|
/**
|
|
|
* Index setting describing for NGramTokenizer and NGramTokenFilter
|
|
|
* the maximum difference between
|
|
@@ -287,6 +296,7 @@ public final class IndexSettings {
|
|
|
private volatile boolean TTLPurgeDisabled;
|
|
|
private volatile TimeValue searchIdleAfter;
|
|
|
private volatile int maxAnalyzedOffset;
|
|
|
+ private volatile int maxTermsCount;
|
|
|
|
|
|
/**
|
|
|
* The maximum number of refresh listeners allows on this shard.
|
|
@@ -397,6 +407,7 @@ public final class IndexSettings {
|
|
|
maxRefreshListeners = scopedSettings.get(MAX_REFRESH_LISTENERS_PER_SHARD);
|
|
|
maxSlicesPerScroll = scopedSettings.get(MAX_SLICES_PER_SCROLL);
|
|
|
maxAnalyzedOffset = scopedSettings.get(MAX_ANALYZED_OFFSET_SETTING);
|
|
|
+ maxTermsCount = scopedSettings.get(MAX_TERMS_COUNT_SETTING);
|
|
|
this.mergePolicyConfig = new MergePolicyConfig(logger, this);
|
|
|
this.indexSortConfig = new IndexSortConfig(this);
|
|
|
searchIdleAfter = scopedSettings.get(INDEX_SEARCH_IDLE_AFTER);
|
|
@@ -440,6 +451,7 @@ public final class IndexSettings {
|
|
|
scopedSettings.addSettingsUpdateConsumer(INDEX_REFRESH_INTERVAL_SETTING, this::setRefreshInterval);
|
|
|
scopedSettings.addSettingsUpdateConsumer(MAX_REFRESH_LISTENERS_PER_SHARD, this::setMaxRefreshListeners);
|
|
|
scopedSettings.addSettingsUpdateConsumer(MAX_ANALYZED_OFFSET_SETTING, this::setHighlightMaxAnalyzedOffset);
|
|
|
+ scopedSettings.addSettingsUpdateConsumer(MAX_TERMS_COUNT_SETTING, this::setMaxTermsCount);
|
|
|
scopedSettings.addSettingsUpdateConsumer(MAX_SLICES_PER_SCROLL, this::setMaxSlicesPerScroll);
|
|
|
scopedSettings.addSettingsUpdateConsumer(DEFAULT_FIELD_SETTING, this::setDefaultFields);
|
|
|
scopedSettings.addSettingsUpdateConsumer(INDEX_SEARCH_IDLE_AFTER, this::setSearchIdleAfter);
|
|
@@ -734,6 +746,13 @@ public final class IndexSettings {
|
|
|
|
|
|
private void setHighlightMaxAnalyzedOffset(int maxAnalyzedOffset) { this.maxAnalyzedOffset = maxAnalyzedOffset; }
|
|
|
|
|
|
+ /**
|
|
|
+ * Returns the maximum number of terms that can be used in a Terms Query request
|
|
|
+ */
|
|
|
+ public int getMaxTermsCount() { return this.maxTermsCount; }
|
|
|
+
|
|
|
+ private void setMaxTermsCount (int maxTermsCount) { this.maxTermsCount = maxTermsCount; }
|
|
|
+
|
|
|
/**
|
|
|
* Returns the maximum number of allowed script_fields to retrieve in a search request
|
|
|
*/
|