How to speed up Elasticsearch recovery?

Edit To prioritize recovery on certain indices, you can use the priority setting on index this way:

PUT some_index
{
  "settings": {
    "index.priority": 10
  }
}

The index with the biggest priority will be recovered first, otherwise the recovery is ordered by creation time of the index, see this

Second Edit To change the number of replicas, you simply need a HTTP request:

PUT  index_name/_settings
{
  "index":{
    "number_of_replicas" : "0"
  }
}

Regarding snapshot recovery, I would suggest the following points (some might not be applicable to your case):

  • put the number of replicas at 0 before the recovery then swap it back to its default value(less writing)
  • if using spinning disk, you can add to the elasticsearch.yml to increase the indexing speed: index.merge.scheduler.max_thread_count: 1 (see here)
  • Update before recovery your index settings with: "refresh_interval" : "-1" and put it back at its default value afterward(see the doc)

If you don't care about searching yet, the following on your ES5 cluster could also help:

PUT /_cluster/settings
{
    "transient" : {
        "indices.store.throttle.type" : "none" 
    }
}

A few articles below that could help:

  • https://www.elastic.co/guide/en/elasticsearch/reference/5.x/tune-for-indexing-speed.html
  • https://www.elastic.co/guide/en/elasticsearch/reference/5.x/tune-for-disk-usage.html

A few general tips: be sure you have swapping disable. How much memory is allocated to your nodes in the ES cluster? (You should use half of the total available memory of a node, with a cap at 32 GB due to some memory addressing limit issue of jvms).


In my case the max_concurrent_file_chunks was also needed, so I set it to max value 5

Reference: https://www.elastic.co/guide/en/elasticsearch/reference/current/recovery.html