java.lang.Object
org.elasticsearch.index.IndexSettings
This class encapsulates all index level settings and handles settings updates.
It's created per index and available to all index level classes and allows them to retrieve
the latest updated settings instance. Classes that need to listen to settings updates can register
a settings consumer at index creation via
IndexModule.addSettingsUpdateConsumer(Setting, Consumer)
that will
be called for each settings update.-
Field Summary
FieldsModifier and TypeFieldDescriptionThis index setting is intentionally undocumented and should be used as an escape hatch to disable BloomFilter of the _id field of non-data-stream indices, which is enabled by default.static final TimeValue
Index setting to enable / disable deletes garbage collection.static final TimeValue
Determines a balance between file-based and operations-based peer recoveries.static final NodeFeature
The `index.mapping.ignore_above` setting defines the maximum length for the content of a field that will be indexed or stored.Only intended for stateless.static final Setting<ByteSizeValue>
The minimum size of a merge that triggers a flush in order to free resourcesMarks an index to be searched throttled.Controls the maximum length of time since a retention lease is created or renewed before it is considered expired.Controls how many soft-deleted documents will be kept around before being merged away.Specifies if the index should use soft-delete instead of hard-delete for update/delete operations.static final Setting<Translog.Durability>
static final Setting<ByteSizeValue>
static final Setting<ByteSizeValue>
The maximum size of a translog generation.Controls how long translog files that are no longer needed for persistence reasons will be kept around before being deleted.static final Setting<ByteSizeValue>
Controls how many translog files that are no longer needed for persistence reasons will be kept around before being deleted.static final String
static final String
Deprecated.A setting describing the maximum number of characters that will be analyzed for a highlight request.Index setting describing the maximum value of allowed `docvalue_fields`that can be retrieved per search request.Index setting describing the maximum value of from + size on an individual inner hit definition or top hits aggregation.Index setting describing for NGramTokenizer and NGramTokenFilter the maximum difference between max_gram (maximum length of characters in a gram) and min_gram (minimum length of characters in a gram).The maximum number of refresh listeners allows on this shard.The maximum length of regex string allowed in a regexp query.Index setting describing the maximum size of the rescore window.Index setting describing the maximum value of from + size on a query.Index setting describing the maximum value of allowed `script_fields`that can be retrieved per search request.Index setting describing for ShingleTokenFilter the maximum difference between max_shingle_size and min_shingle_size.The maximum number of slices allowed in a scroll requestIndex setting describing the maximum number of terms that can be used in Terms Query.A setting describing the maximum number of tokens that can be produced using _analyze API.The"mode"
of the index.static final String
static TimeValue
static TimeValue
in time series mode, the end time of the index, timestamp must smaller than start_timein time series mode, the start time of the index, timestamp must larger than start_timeIndex setting to enable/disable theUnifiedHighlighter.HighlightFlag.WEIGHT_MATCHES
mode of the unified highlighter. -
Constructor Summary
ConstructorsConstructorDescriptionIndexSettings
(IndexMetadata indexMetadata, Settings nodeSettings) Creates a newIndexSettings
instance.IndexSettings
(IndexMetadata indexMetadata, Settings nodeSettings, IndexScopedSettings indexScopedSettings) Creates a newIndexSettings
instance. -
Method Summary
Modifier and TypeMethodDescriptionReturns the customDataPath for this index, if configured.Returns the default search fields for this index.Returns the merge threshold size when to forcefully flush the index and free resources.Returns the transaction log threshold age when to forcefully flush the index and clear the transaction log.getFlushThresholdSize
(ByteSizeValue totalDiskSpace) Returns the transaction log threshold size when to forcefully flush the index and clear the transaction log.long
Returns the GC deletes cycle in milliseconds.Returns the generation threshold size.int
Returns the maximum number of chars that will be analyzed in a highlight requestgetIndex()
Returns the index this settings object belongs toReturns the current IndexMetadata for this indexThe way that documents are routed on the coordinating node when being sent to shards of this index.Returns the index sort config that should be used for this index.Returns the version the index was created on.long
long
long
long
long
long
int
Returns the maximum number of allowed docvalue_fields to retrieve in a search requestint
Returns the max result window for an individual inner hit definition or top hits aggregation.int
Returns the maximum allowed difference between max and min length of ngramint
The maximum number of refresh listeners allows on this shard.int
The maximum length of regex string allowed in a regexp query.int
Returns the maximum rescore window for search requests.int
Returns the max result window for search requests, describing the maximum value of from + size on a query.int
Returns the maximum number of allowed script_fields to retrieve in a search requestint
Returns the maximum allowed difference between max and min shingle_sizeint
The maximum number of slices allowed in a scroll request.int
Returns the maximum number of terms that can be used in a Terms Query requestint
Returns the maximum number of tokens that can be producedorg.apache.lucene.index.MergePolicy
getMergePolicy
(boolean isTimeBasedIndex) Returns the merge policy that should be used for this index.Returns theMergeSchedulerConfig
getMode()
"Mode" that controls which behaviors and settings an index supports.Returns the current node nameReturns the node settings.int
Returns the number of replicas this index has.int
Returns the number of shards this index has.Returns this interval in which the shards of this index are asynchronously refreshed.long
The maximum age of a retention lease before it is considered expired.Returns the time that an index shard becomes search idle unless it's accessed in betweenReturns the settings for this index.boolean
boolean
long
Returns the number of extra operations (i.e.The bounds for@timestamp
on this index ornull
if there are no bounds.Returns the translog durability for this index.Returns the translog sync interval.getUUID()
Returns the indexes UUID<T> T
boolean
Returnstrue
if the index has a custom data pathboolean
Returnstrue
if queries should be lenient about unmapped fields.boolean
Returnstrue
if TSDB encoding is enabled.boolean
Returns true iff the refresh setting exists or in other words is explicitly set.boolean
Only intended for stateless.boolean
boolean
Returnstrue
if the query string parser should allow leading wildcards.boolean
Returnstrue
if the query string should analyze wildcards.boolean
Returnstrue
if query string parsing should be lenient.boolean
boolean
Returns true if the this index should be searched throttled ie.boolean
Returnstrue
if soft-delete is enabled.boolean
Returns true if index warmers are enabled, otherwisefalse
boolean
static boolean
Compare the specified settings for equality.void
setDefaultPipeline
(String defaultPipeline) void
setRequiredPipeline
(String requiredPipeline) void
setTranslogSyncInterval
(TimeValue translogSyncInterval) The default mode for storing source, for all mappers not overriding this setting.boolean
updateIndexMetadata
(IndexMetadata indexMetadata) Updates the settings and index metadata and notifies all registered settings consumers with the new settings iff at least one setting has changed.
-
Field Details
-
DEFAULT_FIELD_SETTING
-
QUERY_STRING_LENIENT_SETTING
-
QUERY_STRING_ANALYZE_WILDCARD
-
QUERY_STRING_ALLOW_LEADING_WILDCARD
-
ALLOW_UNMAPPED
-
INDEX_TRANSLOG_SYNC_INTERVAL_SETTING
-
INDEX_SEARCH_IDLE_AFTER
-
INDEX_TRANSLOG_DURABILITY_SETTING
-
INDEX_WARMER_ENABLED_SETTING
-
INDEX_CHECK_ON_STARTUP
-
MAX_RESULT_WINDOW_SETTING
Index setting describing the maximum value of from + size on a query. The Default maximum value of from + size on a query is 10,000. This was chosen as a conservative default as it is sure to not cause trouble. Users can certainly profile their cluster and decide to set it to 100,000 safely. 1,000,000 is probably way to high for any cluster to set safely. -
MAX_INNER_RESULT_WINDOW_SETTING
Index setting describing the maximum value of from + size on an individual inner hit definition or top hits aggregation. The default maximum of 100 is defensive for the reason that the number of inner hit responses and number of top hits buckets returned is unbounded. Profile your cluster when increasing this setting. -
MAX_SCRIPT_FIELDS_SETTING
Index setting describing the maximum value of allowed `script_fields`that can be retrieved per search request. The default maximum of 32 is defensive for the reason that retrieving script fields is a costly operation. -
MAX_TOKEN_COUNT_SETTING
A setting describing the maximum number of tokens that can be produced using _analyze API. The default maximum of 10000 is defensive to prevent generating too many token objects. -
MAX_ANALYZED_OFFSET_SETTING
A setting describing the maximum number of characters that will be analyzed for a highlight request. This setting is only applicable when highlighting is requested on a text that was indexed without offsets or term vectors. The default maximum of 1M characters is defensive as for highlighting larger texts, indexing with offsets or term vectors is recommended. -
WEIGHT_MATCHES_MODE_ENABLED_SETTING
Index setting to enable/disable theUnifiedHighlighter.HighlightFlag.WEIGHT_MATCHES
mode of the unified highlighter. -
MAX_TERMS_COUNT_SETTING
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. -
MAX_NGRAM_DIFF_SETTING
Index setting describing for NGramTokenizer and NGramTokenFilter the maximum difference between max_gram (maximum length of characters in a gram) and min_gram (minimum length of characters in a gram). The default value is 1 as this is default difference in NGramTokenizer, and is defensive as it prevents generating too many index terms. -
MAX_SHINGLE_DIFF_SETTING
Index setting describing for ShingleTokenFilter the maximum difference between max_shingle_size and min_shingle_size. The default value is 3 is defensive as it prevents generating too many tokens. -
MAX_DOCVALUE_FIELDS_SEARCH_SETTING
Index setting describing the maximum value of allowed `docvalue_fields`that can be retrieved per search request. The default maximum of 100 is defensive for the reason that retrieving doc values might incur a per-field per-document seek. -
MAX_RESCORE_WINDOW_SETTING
Index setting describing the maximum size of the rescore window. Defaults toMAX_RESULT_WINDOW_SETTING
because they both do the same thing: control the size of the heap of hits. -
INDEX_FAST_REFRESH_SETTING
Only intended for stateless. -
DEFAULT_REFRESH_INTERVAL
-
NODE_DEFAULT_REFRESH_INTERVAL_SETTING
-
STATELESS_DEFAULT_REFRESH_INTERVAL
-
STATELESS_MIN_NON_FAST_REFRESH_INTERVAL
-
INDEX_REFRESH_INTERVAL_SETTING
-
INDEX_TRANSLOG_FLUSH_THRESHOLD_SIZE_SETTING
-
INDEX_TRANSLOG_FLUSH_THRESHOLD_AGE_SETTING
-
INDEX_FLUSH_AFTER_MERGE_THRESHOLD_SIZE_SETTING
The minimum size of a merge that triggers a flush in order to free resources -
INDEX_TRANSLOG_GENERATION_THRESHOLD_SIZE_SETTING
The maximum size of a translog generation. This is independent of the maximum size of translog operations that have not been flushed. -
DEFAULT_GC_DELETES
Index setting to enable / disable deletes garbage collection. This setting is realtime updateable -
INDEX_GC_DELETES_SETTING
-
INDEX_SOFT_DELETES_SETTING
Specifies if the index should use soft-delete instead of hard-delete for update/delete operations. Soft-deletes is enabled by default for 7.0 indices and mandatory for 8.0 indices. -
INDEX_SOFT_DELETES_RETENTION_OPERATIONS_SETTING
Controls how many soft-deleted documents will be kept around before being merged away. Keeping more deleted documents increases the chance of operation-based recoveries and allows querying a longer history of documents. If soft-deletes is enabled, an engine by default will retain all operations up to the global checkpoint. -
INDEX_TRANSLOG_RETENTION_AGE_SETTING
Controls how long translog files that are no longer needed for persistence reasons will be kept around before being deleted. Keeping more files is useful to increase the chance of ops based recoveries for indices with soft-deletes disabled. TODO: Remove this setting in 9.0. -
INDEX_TRANSLOG_RETENTION_SIZE_SETTING
Controls how many translog files that are no longer needed for persistence reasons will be kept around before being deleted. Keeping more files is useful to increase the chance of ops based recoveries for indices with soft-deletes disabled. TODO: Remove this setting in 9.0. -
INDEX_SOFT_DELETES_RETENTION_LEASE_PERIOD_SETTING
Controls the maximum length of time since a retention lease is created or renewed before it is considered expired. -
MAX_REFRESH_LISTENERS_PER_SHARD
The maximum number of refresh listeners allows on this shard. -
MAX_SLICES_PER_SCROLL
The maximum number of slices allowed in a scroll request -
MAX_REGEX_LENGTH_SETTING
The maximum length of regex string allowed in a regexp query. -
DEFAULT_PIPELINE
-
FINAL_PIPELINE
-
INDEX_SEARCH_THROTTLED
Marks an index to be searched throttled. This means that never more than one shard of such an index will be searched concurrently -
FILE_BASED_RECOVERY_THRESHOLD_SETTING
Determines a balance between file-based and operations-based peer recoveries. The number of operations that will be used in an operations-based peer recovery is limited to this proportion of the total number of documents in the shard (including deleted documents) on the grounds that a file-based peer recovery may copy all of the documents in the shard over to the new peer, but is significantly faster than replaying the missing operations on the peer, so once a peer falls far enough behind the primary it makes more sense to copy all the data over again instead of replaying history. Defaults to retaining history for up to 10% of the documents in the shard. This can only be changed in tests, since this setting is intentionally unregistered. -
BLOOM_FILTER_ID_FIELD_ENABLED_SETTING
This index setting is intentionally undocumented and should be used as an escape hatch to disable BloomFilter of the _id field of non-data-stream indices, which is enabled by default. This setting doesn't affect data-stream indices. -
LIFECYCLE_ORIGINATION_DATE
- See Also:
-
LIFECYCLE_ORIGINATION_DATE_SETTING
-
LIFECYCLE_PARSE_ORIGINATION_DATE
- See Also:
-
LIFECYCLE_PARSE_ORIGINATION_DATE_SETTING
-
PREFER_ILM
- See Also:
-
PREFER_ILM_SETTING
-
TIME_SERIES_START_TIME
in time series mode, the start time of the index, timestamp must larger than start_time -
TIME_SERIES_END_TIME
in time series mode, the end time of the index, timestamp must smaller than start_time -
TIME_SERIES_ES87TSDB_CODEC_ENABLED_SETTING
-
MODE
The"mode"
of the index. -
MAX_ADJACENCY_MATRIX_FILTERS_SETTING
Deprecated.Legacy index setting, kept for 7.x BWC compatibility. This setting has no effect in 8.x. Do not use. TODO: Remove in 9.0 -
IGNORE_ABOVE_SETTING
The `index.mapping.ignore_above` setting defines the maximum length for the content of a field that will be indexed or stored. If the length of the field’s content exceeds this limit, the field value will be ignored during indexing. This setting is useful for `keyword`, `flattened`, and `wildcard` fields where very large values are undesirable. It allows users to manage the size of indexed data by skipping fields with excessively long content. As an index-level setting, it applies to all `keyword` and `wildcard` fields, as well as to keyword values within `flattened` fields. When it comes to arrays, the `ignore_above` setting applies individually to each element of the array. If any element's length exceeds the specified limit, only that element will be ignored during indexing, while the rest of the array will still be processed. This behavior is consistent with the field-level `ignore_above` setting. This setting can be overridden at the field level by specifying a custom `ignore_above` value in the field mapping.Example usage:
"index.mapping.ignore_above": 256
NOTE: The value for `ignore_above` is the _character count_, but Lucene counts bytes. Here we set the limit to `32766 / 4 = 8191` since UTF-8 characters may occupy at most 4 bytes.
-
IGNORE_ABOVE_INDEX_LEVEL_SETTING
-
-
Constructor Details
-
IndexSettings
Creates a newIndexSettings
instance. The given node settings will be merged with the settings in the metadata while index level settings will overwrite node settings.- Parameters:
indexMetadata
- the index metadata this settings object is associated withnodeSettings
- the nodes settings this index is allocated on.
-
IndexSettings
public IndexSettings(IndexMetadata indexMetadata, Settings nodeSettings, IndexScopedSettings indexScopedSettings) Creates a newIndexSettings
instance. The given node settings will be merged with the settings in the metadata while index level settings will overwrite node settings.- Parameters:
indexMetadata
- the index metadata this settings object is associated withnodeSettings
- the nodes settings this index is allocated on.
-
-
Method Details
-
isES87TSDBCodecEnabled
public boolean isES87TSDBCodecEnabled()Returnstrue
if TSDB encoding is enabled. The default istrue
-
getRetentionLeaseMillis
public long getRetentionLeaseMillis()The maximum age of a retention lease before it is considered expired.- Returns:
- the maximum age
-
sourceKeepMode
The default mode for storing source, for all mappers not overriding this setting. This is only relevant for indexes configured with synthetic-source code. -
getDefaultFields
Returns the default search fields for this index. -
isQueryStringLenient
public boolean isQueryStringLenient()Returnstrue
if query string parsing should be lenient. The default isfalse
-
isQueryStringAnalyzeWildcard
public boolean isQueryStringAnalyzeWildcard()Returnstrue
if the query string should analyze wildcards. The default isfalse
-
isQueryStringAllowLeadingWildcard
public boolean isQueryStringAllowLeadingWildcard()Returnstrue
if the query string parser should allow leading wildcards. The default istrue
-
isDefaultAllowUnmappedFields
public boolean isDefaultAllowUnmappedFields()Returnstrue
if queries should be lenient about unmapped fields. The default istrue
-
getSettings
Returns the settings for this index. These settings contain the node and index level settings where settings that are specified on both index and node level are overwritten by the index settings. -
getIndex
Returns the index this settings object belongs to -
getUUID
Returns the indexes UUID -
hasCustomDataPath
public boolean hasCustomDataPath()Returnstrue
if the index has a custom data path -
customDataPath
Returns the customDataPath for this index, if configured.""
o.w. -
getIndexVersionCreated
Returns the version the index was created on.- See Also:
-
getNodeName
Returns the current node name -
getIndexMetadata
Returns the current IndexMetadata for this index -
getNumberOfShards
public int getNumberOfShards()Returns the number of shards this index has. -
getNumberOfReplicas
public int getNumberOfReplicas()Returns the number of replicas this index has. -
getMode
"Mode" that controls which behaviors and settings an index supports. -
getNodeSettings
Returns the node settings. The settings returned fromgetSettings()
are a merged version of the index settings and the node settings where node settings are overwritten by index settings. -
updateIndexMetadata
Updates the settings and index metadata and notifies all registered settings consumers with the new settings iff at least one setting has changed.- Returns:
true
iff any setting has been updated otherwisefalse
.
-
same
Compare the specified settings for equality.- Parameters:
left
- the left settingsright
- the right settings- Returns:
- true if the settings are the same, otherwise false
-
getTranslogDurability
Returns the translog durability for this index. -
isWarmerEnabled
public boolean isWarmerEnabled()Returns true if index warmers are enabled, otherwisefalse
-
getTranslogSyncInterval
Returns the translog sync interval. This is the interval in which the transaction log is asynchronously fsynced unless the transaction log is fsyncing on every operations -
setTranslogSyncInterval
-
getRefreshInterval
Returns this interval in which the shards of this index are asynchronously refreshed.-1
means async refresh is disabled. -
isFastRefresh
public boolean isFastRefresh()Only intended for stateless. -
getFlushThresholdSize
Returns the transaction log threshold size when to forcefully flush the index and clear the transaction log. -
getFlushThresholdAge
Returns the transaction log threshold age when to forcefully flush the index and clear the transaction log. -
getFlushAfterMergeThresholdSize
Returns the merge threshold size when to forcefully flush the index and free resources. -
getGenerationThresholdSize
Returns the generation threshold size. As sequence numbers can cause multiple generations to be preserved for rollback purposes, we want to keep the size of individual generations from growing too large to avoid excessive disk space consumption. Therefore, the translog is automatically rolled to a new generation when the current generation exceeds this generation threshold size.- Returns:
- the generation threshold size
-
getMergeSchedulerConfig
Returns theMergeSchedulerConfig
-
getMaxResultWindow
public int getMaxResultWindow()Returns the max result window for search requests, describing the maximum value of from + size on a query. -
getMaxInnerResultWindow
public int getMaxInnerResultWindow()Returns the max result window for an individual inner hit definition or top hits aggregation. -
getMaxRescoreWindow
public int getMaxRescoreWindow()Returns the maximum rescore window for search requests. -
getMaxDocvalueFields
public int getMaxDocvalueFields()Returns the maximum number of allowed docvalue_fields to retrieve in a search request -
getMaxTokenCount
public int getMaxTokenCount()Returns the maximum number of tokens that can be produced -
getMaxNgramDiff
public int getMaxNgramDiff()Returns the maximum allowed difference between max and min length of ngram -
getMaxShingleDiff
public int getMaxShingleDiff()Returns the maximum allowed difference between max and min shingle_size -
getHighlightMaxAnalyzedOffset
public int getHighlightMaxAnalyzedOffset()Returns the maximum number of chars that will be analyzed in a highlight request -
isWeightMatchesEnabled
public boolean isWeightMatchesEnabled() -
getMaxTermsCount
public int getMaxTermsCount()Returns the maximum number of terms that can be used in a Terms Query request -
getMaxScriptFields
public int getMaxScriptFields()Returns the maximum number of allowed script_fields to retrieve in a search request -
getGcDeletesInMillis
public long getGcDeletesInMillis()Returns the GC deletes cycle in milliseconds. -
getMergePolicy
public org.apache.lucene.index.MergePolicy getMergePolicy(boolean isTimeBasedIndex) Returns the merge policy that should be used for this index. -
getValue
-
getMaxRefreshListeners
public int getMaxRefreshListeners()The maximum number of refresh listeners allows on this shard. -
getMaxSlicesPerScroll
public int getMaxSlicesPerScroll()The maximum number of slices allowed in a scroll request. -
getMaxRegexLength
public int getMaxRegexLength()The maximum length of regex string allowed in a regexp query. -
getIndexSortConfig
Returns the index sort config that should be used for this index. -
getScopedSettings
-
isExplicitRefresh
public boolean isExplicitRefresh()Returns true iff the refresh setting exists or in other words is explicitly set. -
getSearchIdleAfter
Returns the time that an index shard becomes search idle unless it's accessed in between -
getDefaultPipeline
-
setDefaultPipeline
-
getRequiredPipeline
-
setRequiredPipeline
-
isSoftDeleteEnabled
public boolean isSoftDeleteEnabled()Returnstrue
if soft-delete is enabled. -
getSoftDeleteRetentionOperations
public long getSoftDeleteRetentionOperations()Returns the number of extra operations (i.e. soft-deleted documents) to be kept for recoveries and history purpose. -
isSearchThrottled
public boolean isSearchThrottled()Returns true if the this index should be searched throttled ie. using theThreadPool.Names.SEARCH_THROTTLED
thread-pool -
getMappingNestedFieldsLimit
public long getMappingNestedFieldsLimit() -
getMappingNestedDocsLimit
public long getMappingNestedDocsLimit() -
getMappingTotalFieldsLimit
public long getMappingTotalFieldsLimit() -
isIgnoreDynamicFieldsBeyondLimit
public boolean isIgnoreDynamicFieldsBeyondLimit() -
getMappingDepthLimit
public long getMappingDepthLimit() -
getMappingFieldNameLengthLimit
public long getMappingFieldNameLengthLimit() -
getMappingDimensionFieldsLimit
public long getMappingDimensionFieldsLimit() -
getSkipIgnoredSourceWrite
public boolean getSkipIgnoredSourceWrite() -
getSkipIgnoredSourceRead
public boolean getSkipIgnoredSourceRead() -
getIndexMappingSourceMode
-
isRecoverySourceEnabled
public boolean isRecoverySourceEnabled()- Returns:
- Whether recovery source should be enabled if needed. Note that this is a node setting, and this setting is not sourced from index settings.
-
getTimestampBounds
The bounds for@timestamp
on this index ornull
if there are no bounds. -
getIndexRouting
The way that documents are routed on the coordinating node when being sent to shards of this index.
-