liveBook · Manning

Settings endpoint

As explained in Elasticsearch in Action, Second Edition

An Elasticsearch endpoint for reading and changing index settings.

The settings endpoint, written as _settings, reads an index’s configuration and changes settings that Elasticsearch permits. Create an index with essential settings up front, then adjust dynamic settings while the index remains operational. section 6.2.3

Use the endpoint according to the kind of setting you need to manage:

  • Set static properties, such as primary shard count or compression codec, during index creation; changing them later requires closing or recreating the index. section 6.2.3
  • Change dynamic properties, such as replica count, write blocking, or refresh interval, on a live index. section 6.2.3
  • Fetch one index, several named indexes, wildcard-matched indexes, or a single setting attribute. section 6.2.3

Tune refresh during a migration

PUT movies/_settings { "index": { "refresh_interval": "60s" } } A longer interval reduces refresh activity while documents are indexed. Setting refresh_interval to -1 disables refresh temporarily; after the migration, POST movies/_refresh makes accumulated documents searchable. The setting is dynamic, so this change can be made on a live index. section 5.1.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
  }
}

A complete creation request shows how shard count, replicas, compression, script-field limits, and refresh interval are supplied together under settings. section 6.2.3

Change replicas or block writes

PUT cars_with_custom_settings/_settings { "settings": { "number_of_replicas": 2 } } For an index operation such as splitting, use the same endpoint to make the source read-only by setting index.blocks.write to true before invoking the split API. section 6.8.1

How Elasticsearch in Action, Second Edition covers it

How deep it goes
Defines static and dynamic settings and demonstrates REST requests, but defers the complete catalog of supported properties.
Examples
Uses cars_with_custom_settings, movies refresh tuning, multi-index retrieval, and all_cars read-only preparation.
What it assumes
Assumes basic Elasticsearch index and REST request knowledge while introducing static-versus-dynamic settings distinctions.
What you can do after
Operate/configure Elasticsearch indexes by reading settings and safely changing supported dynamic properties.
How it connects
Connects index settings with shards, replicas, refresh intervals, reindexing, and the split API.

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.