2013-08-28 19:24:34 -04:00
|
|
|
[[indices-update-settings]]
|
|
|
|
== Update Indices Settings
|
|
|
|
|
|
|
|
Change 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:
|
|
|
|
|
|
|
|
[source,js]
|
|
|
|
--------------------------------------------------
|
|
|
|
{
|
|
|
|
"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:
|
|
|
|
|
|
|
|
[source,js]
|
|
|
|
--------------------------------------------------
|
|
|
|
curl -XPUT 'localhost:9200/my_index/_settings' -d '
|
|
|
|
{
|
|
|
|
"index" : {
|
|
|
|
"number_of_replicas" : 4
|
|
|
|
} }
|
|
|
|
'
|
|
|
|
--------------------------------------------------
|
|
|
|
|
|
|
|
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.
|
|
|
|
|
2014-04-09 13:44:53 -04:00
|
|
|
`index.auto_expand_replicas` (string)::
|
|
|
|
Set to a dash delimited lower and upper bound (e.g. `0-5`)
|
|
|
|
or one may use `all` as the upper bound (e.g. `0-all`), or `false` to disable it.
|
2013-08-28 19:24:34 -04:00
|
|
|
|
|
|
|
`index.blocks.read_only`::
|
2013-10-15 07:30:56 -04:00
|
|
|
Set to `true` to have the index read only, `false` to allow writes
|
2013-08-28 19:24:34 -04:00
|
|
|
and metadata changes.
|
|
|
|
|
|
|
|
`index.blocks.read`::
|
|
|
|
Set to `true` to disable read operations againstthe 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`::
|
|
|
|
Defaults to `8`.
|
|
|
|
|
|
|
|
`index.codec`::
|
|
|
|
Codec. Default to `default`.
|
|
|
|
|
2013-12-20 04:46:43 -05:00
|
|
|
`index.codec.bloom.load`::
|
|
|
|
Whether to load the bloom filter. Defaults to `true`.
|
|
|
|
See <<bloom-postings>>.
|
|
|
|
|
2013-08-28 19:24:34 -04:00
|
|
|
`index.fail_on_merge_failure`::
|
|
|
|
Default to `true`.
|
|
|
|
|
|
|
|
`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`::
|
2013-10-15 07:30:56 -04:00
|
|
|
Disables flushing. Note, should be set for a short
|
2013-08-28 19:24:34 -04:00
|
|
|
interval and then enabled.
|
|
|
|
|
|
|
|
`index.cache.filter.max_size`::
|
2013-10-15 07:30:56 -04:00
|
|
|
The maximum size of filter cache (per segment in shard).
|
2013-08-28 19:24:34 -04:00
|
|
|
Set to `-1` to disable.
|
|
|
|
|
|
|
|
`index.cache.filter.expire`::
|
2013-10-15 07:30:56 -04:00
|
|
|
The expire after access time for filter cache.
|
2013-08-28 19:24:34 -04:00
|
|
|
Set to `-1` to disable.
|
|
|
|
|
|
|
|
`index.gateway.snapshot_interval`::
|
2013-10-15 07:30:56 -04:00
|
|
|
The gateway snapshot interval (only applies to shared gateways).
|
2013-08-28 19:24:34 -04:00
|
|
|
Defaults to 10s.
|
|
|
|
|
|
|
|
<<index-modules-merge,merge policy>>::
|
2013-10-15 07:30:56 -04:00
|
|
|
All the settings for the merge policy currently configured.
|
2013-08-28 19:24:34 -04:00
|
|
|
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`::
|
2014-01-06 07:24:31 -05:00
|
|
|
Disable allocation. Defaults to `false`. Deprecated in favour for `index.routing.allocation.enable`.
|
2013-08-28 19:24:34 -04:00
|
|
|
|
|
|
|
`index.routing.allocation.disable_new_allocation`::
|
2014-01-06 07:24:31 -05:00
|
|
|
Disable new allocation. Defaults to `false`. Deprecated in favour for `index.routing.allocation.enable`.
|
2013-08-28 19:24:34 -04:00
|
|
|
|
|
|
|
`index.routing.allocation.disable_replica_allocation`::
|
2014-01-06 07:24:31 -05:00
|
|
|
Disable replica allocation. Defaults to `false`. Deprecated in favour for `index.routing.allocation.enable`.
|
|
|
|
|
|
|
|
added[1.0.0.RC1]
|
|
|
|
|
|
|
|
`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.
|
2013-08-28 19:24:34 -04:00
|
|
|
|
|
|
|
`index.routing.allocation.total_shards_per_node`::
|
|
|
|
Controls the total number of shards 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` (or `half`)
|
|
|
|
* `full`
|
2013-10-30 08:57:18 -04:00
|
|
|
* `full-1`.
|
2013-08-28 19:24:34 -04:00
|
|
|
* Number values are also supported, e.g. `1`.
|
|
|
|
|
|
|
|
`index.gc_deletes`::
|
|
|
|
|
|
|
|
`index.ttl.disable_purge`::
|
|
|
|
Disables temporarily the purge of expired docs.
|
|
|
|
|
|
|
|
<<index-modules-store,store level throttling>>::
|
|
|
|
All the settings for the store level throttling policy currently configured.
|
|
|
|
|
|
|
|
`index.translog.fs.type`::
|
|
|
|
Either `simple` or `buffered` (default).
|
|
|
|
|
|
|
|
`index.compound_format`::
|
2013-10-15 07:30:56 -04:00
|
|
|
See <<index-compound-format,`index.compound_format`>> in
|
|
|
|
<<index-modules-settings>>.
|
|
|
|
|
|
|
|
`index.compound_on_flush`::
|
|
|
|
See <<index-compound-on-flush,`index.compound_on_flush>> in
|
|
|
|
<<index-modules-settings>>.
|
2013-08-28 19:24:34 -04:00
|
|
|
|
2013-10-15 07:30:56 -04:00
|
|
|
<<index-modules-slowlog>>::
|
2013-08-28 19:24:34 -04:00
|
|
|
All the settings for slow log.
|
|
|
|
|
|
|
|
`index.warmer.enabled`::
|
|
|
|
See <<indices-warmers>>. Defaults to `true`.
|
|
|
|
|
|
|
|
[float]
|
2013-09-25 12:17:40 -04:00
|
|
|
[[bulk]]
|
2013-08-28 19:24:34 -04:00
|
|
|
=== Bulk Indexing Usage
|
|
|
|
|
|
|
|
For 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:
|
|
|
|
|
|
|
|
[source,js]
|
|
|
|
--------------------------------------------------
|
|
|
|
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):
|
|
|
|
|
|
|
|
[source,js]
|
|
|
|
--------------------------------------------------
|
|
|
|
curl -XPUT localhost:9200/test/_settings -d '{
|
|
|
|
"index" : {
|
|
|
|
"refresh_interval" : "1s"
|
|
|
|
} }'
|
|
|
|
--------------------------------------------------
|
|
|
|
|
|
|
|
And, an optimize should be called:
|
|
|
|
|
|
|
|
[source,js]
|
|
|
|
--------------------------------------------------
|
|
|
|
curl -XPOST 'http://localhost:9200/test/_optimize?max_num_segments=5'
|
|
|
|
--------------------------------------------------
|
|
|
|
|
|
|
|
[float]
|
2013-09-30 17:32:00 -04:00
|
|
|
[[update-settings-analysis]]
|
2013-08-28 19:24:34 -04:00
|
|
|
=== Updating Index Analysis
|
|
|
|
|
|
|
|
It is also possible to define new <<analysis,analyzers>> for the index.
|
|
|
|
But it is required to <<indices-open-close,close>> the index
|
|
|
|
first and <<indices-open-close,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:
|
|
|
|
|
|
|
|
[source,js]
|
|
|
|
--------------------------------------------------
|
|
|
|
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'
|
|
|
|
--------------------------------------------------
|