Suppose you have a system with ElasticSearch server installed and need to upgrade it to a newer version. Below is a step-by-step guide explaining how you can do it, but note that it only works for ElasticSearch pre-1.x versions. It’s also assumed that you have already stopped your ElasticSearch cluster before upgrading.
1) Get the latest ElasticSearch release and move it to the <em>/opt</em> directory:
$ cd ~<br>$ wget https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-0.20.2.tar.gz -O elasticsearch-0.20.2.tar.gz<br>$ tar -xf elasticsearch-0.20.2.tar.gz<br>$ rm elasticsearch-0.20.2.tar.gz<br>$ sudo mv elasticsearch-0.20.2 /opt2) Get a service wrapper execution for ElasticSearch. This enables ElasticSearch to be installed and run as Unix daemon. You need to place the service directory to the /opt/elasticsearch-0.20.2/bin:
$ curl -L https://github.com/elasticsearch/elasticsearch-servicewrapper/tarball/master | tar -xz
$ mv *servicewrapper*/service /opt/elasticsearch-0.20.2/bin/
$ rm -Rf *servicewrapper*3) Remove older version of ElasticSearch and install the newest one:
$ /opt/elasticsearch-0.18.7/bin/service/elasticsearch remove
$ sudo /opt/elasticsearch-0.20.2/bin/service/elasticsearch install
$ sudo /etc/init.d/elasticsearch start4) Check version:
$ curl 'https://localhost:9200'You must see something like this:
{
"ok" : true,
"status" : 200,
"name" : "Max",
"version" : {
"number" : "0.20.2",
"snapshot_build" : false
},
"tagline" : "You Know, for Search"
}5) Upgrade elasticsearch-head plugin:
$ /opt/elasticsearch-0.18.7/bin/plugin -remove mobz/elasticsearch-head
$ /opt/elasticsearch-0.20.2/bin/plugin -install mobz/elasticsearch-headEnjoy!
UPD. For full info on ElasticSearch upgrade process (including rolling upgrade on newer versions), follow this reference from official ElasticSearch portal: https://www.elastic.co/guide/en/elasticsearch/reference/1.4/setup-upgrade.html.
