- Elasticsearch Guide: other versions:
- Getting Started
- Setup
- Breaking changes
- API Conventions
- Document APIs
- Search APIs
- Search
- URI Search
- Request Body Search
- Search Template
- Search Shards API
- Aggregations
- Min Aggregation
- Max Aggregation
- Sum Aggregation
- Avg Aggregation
- Stats Aggregation
- Extended Stats Aggregation
- Value Count Aggregation
- Percentiles Aggregation
- Percentile Ranks Aggregation
- Cardinality Aggregation
- Geo Bounds Aggregation
- Top hits Aggregation
- Scripted Metric Aggregation
- Global Aggregation
- Filter Aggregation
- Filters Aggregation
- Missing Aggregation
- Nested Aggregation
- Reverse nested Aggregation
- Children Aggregation
- Terms Aggregation
- Significant Terms Aggregation
- Range Aggregation
- Date Range Aggregation
- IPv4 Range Aggregation
- Histogram Aggregation
- Date Histogram Aggregation
- Geo Distance Aggregation
- GeoHash grid Aggregation
- Facets
- Suggesters
- Multi Search API
- Count API
- Search Exists API
- Validate API
- Explain API
- Percolator
- More Like This API
- Indices APIs
- Create Index
- Delete Index
- Get Index
- Indices Exists
- Open / Close Index API
- Put Mapping
- Get Mapping
- Get Field Mapping
- Types Exists
- Delete Mapping
- Index Aliases
- Update Indices Settings
- Get Settings
- Analyze
- Index Templates
- Warmers
- Status
- Indices Stats
- Indices Segments
- Indices Recovery
- Clear Cache
- Flush
- Refresh
- Optimize
- Upgrade
- Shadow replica indices
- cat APIs
- Cluster APIs
- Query DSL
- Queries
- Match Query
- Multi Match Query
- Bool Query
- Boosting Query
- Common Terms Query
- Constant Score Query
- Dis Max Query
- Filtered Query
- Fuzzy Like This Query
- Fuzzy Like This Field Query
- Function Score Query
- Fuzzy Query
- GeoShape Query
- Has Child Query
- Has Parent Query
- Ids Query
- Indices Query
- Match All Query
- More Like This Query
- Nested Query
- Prefix Query
- Query String Query
- Simple Query String Query
- Range Query
- Regexp Query
- Span First Query
- Span Multi Term Query
- Span Near Query
- Span Not Query
- Span Or Query
- Span Term Query
- Term Query
- Terms Query
- Top Children Query
- Wildcard Query
- Minimum Should Match
- Multi Term Query Rewrite
- Template Query
- Filters
- And Filter
- Bool Filter
- Exists Filter
- Geo Bounding Box Filter
- Geo Distance Filter
- Geo Distance Range Filter
- Geo Polygon Filter
- GeoShape Filter
- Geohash Cell Filter
- Has Child Filter
- Has Parent Filter
- Ids Filter
- Indices Filter
- Limit Filter
- Match All Filter
- Missing Filter
- Nested Filter
- Not Filter
- Or Filter
- Prefix Filter
- Query Filter
- Range Filter
- Regexp Filter
- Script Filter
- Term Filter
- Terms Filter
- Type Filter
- Queries
- Mapping
- Analysis
- Analyzers
- Tokenizers
- Token Filters
- Standard Token Filter
- ASCII Folding Token Filter
- Length Token Filter
- Lowercase Token Filter
- Uppercase Token Filter
- NGram Token Filter
- Edge NGram Token Filter
- Porter Stem Token Filter
- Shingle Token Filter
- Stop Token Filter
- Word Delimiter Token Filter
- Stemmer Token Filter
- Stemmer Override Token Filter
- Keyword Marker Token Filter
- Keyword Repeat Token Filter
- KStem Token Filter
- Snowball Token Filter
- Phonetic Token Filter
- Synonym Token Filter
- Compound Word Token Filter
- Reverse Token Filter
- Elision Token Filter
- Truncate Token Filter
- Unique Token Filter
- Pattern Capture Token Filter
- Pattern Replace Token Filter
- Trim Token Filter
- Limit Token Count Token Filter
- Hunspell Token Filter
- Common Grams Token Filter
- Normalization Token Filter
- CJK Width Token Filter
- CJK Bigram Token Filter
- Delimited Payload Token Filter
- Keep Words Token Filter
- Keep Types Token Filter
- Classic Token Filter
- Apostrophe Token Filter
- Character Filters
- ICU Analysis Plugin
- Modules
- Index Modules
- Testing
- Glossary of terms
WARNING: Version 1.5 of Elasticsearch has passed its EOL date.
This documentation is no longer being maintained and may be removed. If you are running this version, we strongly advise you to upgrade. For the latest information, see the current release documentation.
Update Indices Settings
editUpdate Indices Settings
editChange 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:
-
index.number_of_replicas
- 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 useall
as the upper bound (e.g.0-all
), orfalse
to disable it. -
index.blocks.read_only
-
Set to
true
to have the index read only,false
to allow writes and metadata changes. -
index.blocks.read
-
Set to
true
to disable read operations against the index. -
index.blocks.write
-
Set to
true
to disable write operations against the index. -
index.blocks.metadata
-
Set to
true
to disable metadata operations against the index. -
index.refresh_interval
- The async refresh interval of a shard.
-
index.index_concurrency
-
[preview]
This functionality is in technical preview and may be changed or removed in a future release. Elastic will work to fix any issues, but features in technical preview are not subject to the support SLA of official GA features.
Defaults to
8
. -
index.fail_on_merge_failure
-
[preview]
This functionality is in technical preview and may be changed or removed in a future release. Elastic will work to fix any issues, but features in technical preview are not subject to the support SLA of official GA features.
Default to
true
.
Deprecated in 1.5.0.
As of 2.0 index.fail_on_merge_failure
is removed and the engine will always fail on an unexpected merge exception.
-
index.translog.flush_threshold_ops
- When to flush based on operations.
-
index.translog.flush_threshold_size
- When to flush based on translog (bytes) size.
-
index.translog.flush_threshold_period
- When to flush based on a period of not flushing.
-
index.translog.disable_flush
- Disables flushing. Note, should be set for a short interval and then enabled.
-
index.cache.filter.max_size
-
The maximum size of filter cache (per segment in shard).
Set to
-1
to disable. -
index.cache.filter.expire
-
[preview]
This functionality is in technical preview and may be changed or removed in a future release. Elastic will work to fix any issues, but features in technical preview are not subject to the support SLA of official GA features.
The expire after access time for filter cache.
Set to
-1
to disable. -
index.gateway.snapshot_interval
- [preview] This functionality is in technical preview and may be changed or removed in a future release. Elastic will work to fix any issues, but features in technical preview are not subject to the support SLA of official GA features. 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.
-
index.routing.allocation.include.*
- A node matching any rule will be allowed to host shards from the index.
-
index.routing.allocation.exclude.*
- A node matching any rule will NOT be allowed to host shards from the index.
-
index.routing.allocation.require.*
- Only nodes matching all rules will be allowed to host shards from the index.
-
index.routing.allocation.disable_allocation
-
Disable allocation. Defaults to
false
. Deprecated in favour forindex.routing.allocation.enable
. -
index.routing.allocation.disable_new_allocation
-
Disable new allocation. Defaults to
false
. Deprecated in favour forindex.routing.allocation.enable
. -
index.routing.allocation.disable_replica_allocation
-
Disable replica allocation. Defaults to
false
. Deprecated in favour forindex.routing.allocation.enable
. -
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.
-
-
index.routing.allocation.total_shards_per_node
-
Controls the total number of shards (replicas and primaries) allowed to be allocated on a single node. Defaults to unbounded (
-1
). -
index.recovery.initial_shards
-
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
(orhalf
) -
full
-
full-1
. -
Number values are also supported, e.g.
1
.
-
-
index.gc_deletes
- [preview] This functionality is in technical preview and may be changed or removed in a future release. Elastic will work to fix any issues, but features in technical preview are not subject to the support SLA of official GA features.
-
index.ttl.disable_purge
- [preview] This functionality is in technical preview and may be changed or removed in a future release. Elastic will work to fix any issues, but features in technical preview are not subject to the support SLA of official GA features. Disables temporarily the purge of expired docs.
- store level throttling
- All the settings for the store level throttling policy currently configured.
-
index.translog.fs.type
-
[preview]
This functionality is in technical preview and may be changed or removed in a future release. Elastic will work to fix any issues, but features in technical preview are not subject to the support SLA of official GA features.
Either
simple
orbuffered
(default). -
index.compound_format
-
[preview]
This functionality is in technical preview and may be changed or removed in a future release. Elastic will work to fix any issues, but features in technical preview are not subject to the support SLA of official GA features.
See
index.compound_format
in Index Settings. -
index.compound_on_flush
- [preview] This functionality is in technical preview and may be changed or removed in a future release. Elastic will work to fix any issues, but features in technical preview are not subject to the support SLA of official GA features. See `index.compound_on_flush in Index Settings.
- Index Slow Log
- All the settings for slow log.
-
index.warmer.enabled
-
See Warmers. Defaults to
true
.
Bulk Indexing Usage
editFor 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 Analysis
editIt 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" : { "analyzer":{ "content":{ "type":"custom", "tokenizer":"whitespace" } } } }' curl -XPOST 'localhost:9200/myindex/_open'
On this page