ELasticsearch Index Settings

Index Settings

  • static
    They can only be set at index creation time or on a closed index.

  • dynamic
    They can be changed on a live index using the update-index-settings API.


Static index settings

Below is a list of all static index settings that are not associated with any specific index module:

  • index.number_of_shards
    The number of primary shards that an index should have. Defaults to 5. This setting can only be set at index creation time. It cannot be changed on a closed index.

  • index.shard.check_on_startup
    This functionality is experimental and may be changed or removed completely in a future release. Elastic will take a best effort approach to fix any issues, but experimental features are not subject to the support SLA of official GA features. Whether or not shards should be checked for corruption before opening. When corruption is detected, it will prevent the shard from being opened. Accepts:

    • false
      (default) Don’t check for corruption when opening a shard.
    • checksum
      Check for physical corruption.
    • true
      Check for both physical and logical corruption. This is much more expensive in terms of CPU and memory usage.
    • fix
      Check for both physical and logical corruption. Segments that were reported as corrupted will be automatically removed. This option may result in data loss. Use with extreme caution!
      Checking shards may take a lot of time on large indices.
  • index.codec
    The default value compresses stored data with LZ4 compression, but this can be set to best_compression which uses DEFLATE for a higher compression ratio, at the expense of slower stored fields performance.


Dynamic index settings

Below is a list of all dynamic index settings that are not associated with any specific index module:

  • index.number_of_replicas
    The number of replicas each primary shard has. Defaults to 1.

  • index.auto_expand_replicas
    Auto-expand the number of replicas based on the number of available nodes. Set to a dash delimited lower and upper bound (e.g. 0-5) or use all for the upper bound (e.g. 0-all). Defaults to false (i.e. disabled).

  • index.refresh_interval
    How often to perform a refresh operation, which makes recent changes to the index visible to search. Defaults to 1s. Can be set to -1 to disable refresh.

  • index.max_result_window
    The maximum value of from + size for searches to this index. Defaults to 10000. Search requests take heap memory and time proportional to from + size and this limits that memory. See to raising this.

  • index.blocks.read_only
    Set to true to make the index and index metadata read only, false to allow writes and metadata changes.

  • index.blocks.read
    Set to true to disable read operations against the index.

  • index.blocks.write
    Set to true to disable write operations against the index.

  • index.blocks.metadata
    Set to true to disable index metadata reads and writes.

  • index.ttl.disable_purge
    This functionality is experimental and may be changed or removed completely in a future release. Elastic will take a best effort approach to fix any issues, but experimental features are not subject to the support SLA of official GA features. Disables the purge of expired docs on the current index.

  • index.recovery.initial_shards
    A primary shard is only recovered only if there are enough nodes available to allocate sufficient replicas to form a quorum. It can be set to:

    • quorum (default)
    • quorum-1 (or half)
    • full
    • full-1.
    • Number values are also supported, e.g. 1.

Update-Indices-Settings


change the number of replicas.

1
2
3
4
5
6
curl -XPUT 'localhost:9200/my_index/_settings' -d 
'{
"index" : {
"number_of_replicas" : 4
}
}'

change refresh interval

1
2
3
4
5
6
curl -XPUT localhost:9200/test/_settings -d 
'{
"index" : {
"refresh_interval" : "1s"
}
}'