Update Indices Settingsedit

Change specific index level settings in real time.

The REST endpoint is /_settings (to update all indices) or {index}/_settings to update one (or more) indices settings. The body of the request includes the updated settings, for example:

    "index" : {
        "number_of_replicas" : 4

The above will change the number of replicas to 4 from the current number of replicas. Here is a curl example:

curl -XPUT 'localhost:9200/my_index/_settings' -d '
    "index" : {
        "number_of_replicas" : 4

When changing the number of replicas the index needs to be open. Changing the number of replicas on a closed index might prevent the index to be opened correctly again.

Below is the list of settings that can be changed using the update settings API:

The number of replicas each shard has.
index.auto_expand_replicas (string)
Set to a dash delimited lower and upper bound (e.g. 0-5) or one may use all as the upper bound (e.g. 0-all), or false to disable it.
Set to true to have the index read only, false to allow writes and metadata changes.
Set to true to disable read operations against the index.
Set to true to disable write operations against the index.
Set to true to disable metadata operations against the index.
The async refresh interval of a shard.
Defaults to 8.
Whether to load the bloom filter. Defaults to false.
Default to true.
When to flush based on operations.
When to flush based on translog (bytes) size.
When to flush based on a period of not flushing.
Disables flushing. Note, should be set for a short interval and then enabled.
The maximum size of filter cache (per segment in shard). Set to -1 to disable.
The expire after access time for filter cache. Set to -1 to disable.
The gateway snapshot interval (only applies to shared gateways). Defaults to 10s.
merge policy
All the settings for the merge policy currently configured. A different merge policy can’t be set.
A node matching any rule will be allowed to host shards from the index.
A node matching any rule will NOT be allowed to host shards from the index.
Only nodes matching all rules will be allowed to host shards from the index.
Disable allocation. Defaults to false. Deprecated in favour for index.routing.allocation.enable.
Disable new allocation. Defaults to false. Deprecated in favour for index.routing.allocation.enable.
Disable replica allocation. Defaults to false. Deprecated in favour for index.routing.allocation.enable.

Enables shard allocation for a specific index. It can be set to:

  • all (default) - Allows shard allocation for all shards.
  • primaries - Allows shard allocation only for primary shards.
  • new_primaries - Allows shard allocation only for primary shards for new indices.
  • none - No shard allocation is allowed.
Controls the total number of shards (replicas and primaries) allowed to be allocated on a single node. Defaults to unbounded (-1).

When using local gateway a particular shard is recovered only if there can be allocated quorum shards in the cluster. It can be set to:

  • quorum (default)
  • quorum-1 (or half)
  • full
  • full-1.
  • Number values are also supported, e.g. 1.
Disables temporarily the purge of expired docs.
store level throttling
All the settings for the store level throttling policy currently configured.
Either simple or buffered (default).
See index.compound_format in Index Settings.
See `index.compound_on_flush in Index Settings.
Index Slow Log
All the settings for slow log.
See Warmers. Defaults to true.

Bulk Indexing Usageedit

For example, the update settings API can be used to dynamically change the index from being more performant for bulk indexing, and then move it to more real time indexing state. Before the bulk indexing is started, use:

curl -XPUT localhost:9200/test/_settings -d '{
    "index" : {
        "refresh_interval" : "-1"
    } }'

(Another optimization option is to start the index without any replicas, and only later adding them, but that really depends on the use case).

Then, once bulk indexing is done, the settings can be updated (back to the defaults for example):

curl -XPUT localhost:9200/test/_settings -d '{
    "index" : {
        "refresh_interval" : "1s"
    } }'

And, an optimize should be called:

curl -XPOST 'http://localhost:9200/test/_optimize?max_num_segments=5'

Updating Index Analysisedit

It is also possible to define new analyzers for the index. But it is required to close the index first and open it after the changes are made.

For example if content analyzer hasn’t been defined on myindex yet you can use the following commands to add it:

curl -XPOST 'localhost:9200/myindex/_close'

curl -XPUT 'localhost:9200/myindex/_settings' -d '{
  "analysis" : {

curl -XPOST 'localhost:9200/myindex/_open'

Bloom filtersedit

Added in 1.4.0.Beta1.

Bloom filters will no longer be loaded into memory at search time by default

Up to version 1.3, Elasticsearch used to generate bloom filters for the _uid field at indexing time and to load them at search time in order to speed-up primary-key lookups by savings disk seeks.

As of 1.4, bloom filters are still generated at indexing time, but they are no longer loaded at search time by default: they consume RAM in proportion to the number of unique terms, which can quickly add up for certain use cases, and separate performance improvements have made the performance gains with bloom filters very small.

You can enable loading of the bloom filter at search time on a per-index basis by updating the index settings:

PUT /old_index/_settings?index.codec.bloom.load=true

This setting, which defaults to false, can be updated on a live index. Note, however, that changing the value will cause the index to be reopened, which will invalidate any existing caches.