This documentation contains work-in-progress information for future Elastic Stack and Cloud releases. Use the version selector to view supported release docs. It also contains some Elastic Cloud serverless information. Check out our serverless docs for more details.
Index recovery prioritization
editIndex recovery prioritization
editUnallocated shards are recovered in order of priority, whenever possible. Indices are sorted into priority order as follows:
-
the optional
index.priority
setting (higher before lower) - the index creation date (higher before lower)
- the index name (higher before lower)
This means that, by default, newer indices will be recovered before older indices.
Use the per-index dynamically updatable index.priority
setting to customise
the index prioritization order. For instance:
resp = client.indices.create( index="index_1", ) print(resp) resp1 = client.indices.create( index="index_2", ) print(resp1) resp2 = client.indices.create( index="index_3", settings={ "index.priority": 10 }, ) print(resp2) resp3 = client.indices.create( index="index_4", settings={ "index.priority": 5 }, ) print(resp3)
response = client.indices.create( index: 'index_1' ) puts response response = client.indices.create( index: 'index_2' ) puts response response = client.indices.create( index: 'index_3', body: { settings: { 'index.priority' => 10 } } ) puts response response = client.indices.create( index: 'index_4', body: { settings: { 'index.priority' => 5 } } ) puts response
const response = await client.indices.create({ index: "index_1", }); console.log(response); const response1 = await client.indices.create({ index: "index_2", }); console.log(response1); const response2 = await client.indices.create({ index: "index_3", settings: { "index.priority": 10, }, }); console.log(response2); const response3 = await client.indices.create({ index: "index_4", settings: { "index.priority": 5, }, }); console.log(response3);
PUT index_1 PUT index_2 PUT index_3 { "settings": { "index.priority": 10 } } PUT index_4 { "settings": { "index.priority": 5 } }
In the above example:
-
index_3
will be recovered first because it has the highestindex.priority
. -
index_4
will be recovered next because it has the next highest priority. -
index_2
will be recovered next because it was created more recently. -
index_1
will be recovered last.
This setting accepts an integer, and can be updated on a live index with the update index settings API:
resp = client.indices.put_settings( index="index_4", settings={ "index.priority": 1 }, ) print(resp)
response = client.indices.put_settings( index: 'index_4', body: { 'index.priority' => 1 } ) puts response
const response = await client.indices.putSettings({ index: "index_4", settings: { "index.priority": 1, }, }); console.log(response);
PUT index_4/_settings { "index.priority": 1 }