WARNING: Version 2.4 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.
Upgrade
editUpgrade
editThe upgrade API allows to upgrade one or more indices to the latest Lucene format through an API. The upgrade process converts any segments written with older formats.
The upgrade API in its current form will not help you to migrate indices created in Elasticsearch 1.x to 5.x.
The upgrade API rewrites an index in the latest Lucene format, but it still retains the original data structures that were used when the index was first created. For instance:
- Doc-values on numeric fields used to use BinaryDocValues, but now use dedicated NumericDocValues.
- The parent-child feature has been completely rewritten to use a new data structure.
- Geo-point fields now require doc values and the Lucene index where, previously, they relied on in-memory calculations.
Migrating 1.x indices to 5.x
There are two ways to migrate 1.x indices to 5.x:
- Reindex them in an Elasticsearch 2.4.x cluster, or
- Use reindex-from-remote to import indices from a 1.x cluster into a 5.x cluster directly.
See the Reindex to Upgrade docs in 5.0 for more information.
Start an upgrade
edit$ curl -XPOST 'http://localhost:9200/twitter/_upgrade'
Upgrading is an I/O intensive operation, and is limited to processing a single shard per node at a time. It also is not allowed to run at the same time as an optimize/force-merge.
This call will block until the upgrade is complete. If the http connection is lost, the request will continue in the background, and any new requests will block until the previous upgrade is complete.
Request Parameters
editThe upgrade
API accepts the following request parameters:
|
If true, only very old segments (from a
previous Lucene major release) will be upgraded. While this will do
the minimal work to ensure the next major release of Elasticsearch can
read the segments, it’s dangerous because it can leave other very old
segments in sub-optimal formats. Defaults to |
Check upgrade status
editUse a GET
request to monitor how much of an index is upgraded. This
can also be used prior to starting an upgrade to identify which
indices you want to upgrade at the same time.
The ancient
byte values that are returned indicate total bytes of
segments whose version is extremely old (Lucene major version is
different from the current version), showing how much upgrading is
necessary when you run with only_ancient_segments=true
.
curl 'http://localhost:9200/twitter/_upgrade?pretty&human'
{ "size": "21gb", "size_in_bytes": "21000000000", "size_to_upgrade": "10gb", "size_to_upgrade_in_bytes": "10000000000" "size_to_upgrade_ancient": "1gb", "size_to_upgrade_ancient_in_bytes": "1000000000" "indices": { "twitter": { "size": "21gb", "size_in_bytes": "21000000000", "size_to_upgrade": "10gb", "size_to_upgrade_in_bytes": "10000000000" "size_to_upgrade_ancient": "1gb", "size_to_upgrade_ancient_in_bytes": "1000000000" } } }
The level of details in the upgrade status command can be controlled by
setting level
parameter to cluster
, index
(default) or shard
levels.
For example, you can run the upgrade status command with level=shard
to
get detailed upgrade information of each individual shard.