An index configuration combines mappings, settings, and aliases so an Elasticsearch index matches its data model and operational needs. section 6.2.1
Configure three complementary parts:
- Mappings define field types and the rules Elasticsearch applies before storing data, such as text, keyword, long, or date. section 6.2.1
- Settings control index behavior, including primary shards, replicas, refresh rate, and compression codec; dynamic settings can change while the index runs. section 6.2.1
- Aliases provide alternate names for indexes, supporting a stable name separate from the physical index name. section 6.2.1
Create a cars index with configuration
PUT cars_index { "settings": { "number_of_replicas": 3, "codec": "best_compression" }, "mappings": { "properties": { "make": { "type": "text" } } }, "aliases": { "cars_search": {} } } Choose mappings deliberately: incorrect inferred types can make later searches unreliable. Select shard and replica values for the intended production workload.
Listing 6.3 Creating an index with custom settings
PUT cars_index_with_sample_settings #1
{
"settings": { #2
"number_of_replicas": 3,
"codec": "best_compression"
}
}
Inspect the focused REST example for creating an index with custom settings, then compare it with mapping and alias configurations. section 6.2.1
