liveBook · Manning

Dynamic index setting

As explained in Elasticsearch in Action, Second Edition

A dynamic index setting is an Elasticsearch index configuration value that can be changed while the index is operational.

A dynamic index setting lets you adjust selected index behavior without taking a running index offline. This is useful when production search needs change: increase replicas for more read capacity, alter the refresh interval, or temporarily allow or block writes. Elasticsearch accepts these changes only for settings classified as dynamic; static settings require a closed index or a replacement index. section 6.2.3 section 14.1.3

For example, a car-search index might start with five replicas, then need fewer replicas after demand drops. Send an update to the index’s `_settings` endpoint rather than recreating the index. section 6.2.3

Listing 6.6 Updating dynamic property on an index
PUT cars_with_custom_settings/_settings
{
  "settings": {
    "number_of_replicas": 2
  }
}

This request changes `number_of_replicas` from its current value to `2` while `cars_with_custom_settings` remains operational. `number_of_replicas` is dynamic, so the update does not require closing the index. section 6.2.3

Use dynamic settings for operational changes such as:

Scale reads by adding replicas

If read queries become a bottleneck, increase `number_of_replicas` on the live index. Each added replica is a copy of a shard and can serve read requests, so Elasticsearch can route more searches across replicas. Plan cluster memory and disk capacity first: every replica consumes resources comparable to its primary shard. section 14.1.3

Do not treat every index setting as dynamic. `number_of_shards`, compression codec, and startup data checks are static examples. Trying to update a static setting on a live index produces an error; changing shard count requires closing and recreating the index, then reindexing data if needed. Set required static choices at creation time, and reserve dynamic settings for runtime tuning. section 6.2.3 section 14.1.3

How Elasticsearch in Action, Second Edition covers it

How deep it goes
Defines dynamic versus static settings and demonstrates a live replica update, while deferring the complete supported-settings list to documentation.
Examples
Uses car indexes to update replicas and a chat index to raise replicas from production read demand.
What it assumes
Introduces index settings from zero through concrete REST requests and distinguishes operational indexes from closed indexes.
What you can do after
Operate/configure a live index by updating dynamic settings and recognize when static changes require recreation or reindexing.
How it connects
Connects index settings with replicas, shards, refresh intervals, writes, reindexing, and read throughput.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Elasticsearch in Action, Second Edition. The section links point to the parts of the book it draws on.