liveBook · Manning

Index setting

As explained in Elasticsearch in Action, Second Edition

A configuration property that controls operational characteristics of an Elasticsearch index, including its shards and replicas.

Index settings are configuration properties that tune how an Elasticsearch index operates. They control shard and replica counts and other properties affecting efficiency, resiliency, scalability, and availability. section 6.0 section 3.2.2

Choose settings when creating an index, either from defaults or custom values. Static settings, such as the number of shards, cannot change while the index operates; closing or recreating the index is required. Dynamic settings, such as replica counts and refresh intervals, can change on a live index. section 6.2.3

Listing 6.5 Creating an index with custom settings
PUT cars_with_custom_settings        #1
{
  "settings":{                       #2
    "number_of_shards":3,            #3
    "number_of_replicas":5,          #4
    "codec": "best_compression",     #5
    "max_script_fields":128,         #6
    "refresh_interval": "60s"        #7
  }
}

Create an index with three shards, five replicas per shard, compression, a script-field limit, and a 60-second refresh interval. section 6.2.3

Change a dynamic setting

A live index can change its replica count through the _settings API: PUT cars_with_custom_settings/_settings { "settings": { "number_of_replicas": 2 } } Use GET cars_with_custom_settings/_settings to inspect the complete configuration, or request index.number_of_shards to retrieve one attribute. Plan static settings carefully because changing them later requires downtime or an upgrade strategy such as reindexing. section 6.2.3

Replica choices affect capacity because each replica stores an additional copy of the data. Estimate present and future data requirements before choosing index sizing, and prefer index templates for consistent configuration across new indexes. section 3.2.2 section 6.0

How Elasticsearch in Action, Second Edition covers it

How deep it goes
Explains custom values, static versus dynamic behavior, REST updates, retrieval, sizing, and templates, but defers detailed setting documentation.
Examples
Uses cars_with_custom_settings with shard, replica, codec, script-field, and refresh settings plus REST update and retrieval requests.
What it assumes
Assumes basic familiarity with Elasticsearch indexes and REST APIs while introducing settings, shards, replicas, and templates.
What you can do after
Operate/configure indexes through Elasticsearch REST APIs and distinguish live updates from creation-time changes.
How it connects
Connects settings with shards, replicas, mappings, aliases, index templates, reindexing, and index sizing.

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.