Issues with elasticsearch after upgrading from 7 to 9

These are my personal notes while planning to upgrade from 7 to 9, i tested it on my staging system

DISCLAIMER: NO WARRANTY

Overview

Upgrading from 7.17 to 9.3.1 requires two major upgrades. Each major upgrade must be prepared and executed independently, although the planning phase can be shared.

  1. 7.17.x → 8.19.xThis brings the cluster onto the latest supported 8.x release, which is the required intermediate version before upgrading to 9.3.1.Before running this upgrade, all ingest components and client libraries must be upgraded to 7.17.x.
  2. 8.19.x → 9.3.1This completes the upgrade to the latest 9.x release.Before running this upgrade, all ingest components and client libraries must be upgraded to 8.19.x.

1) Upgrade to 7.17.29 (from any 7.x)

wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.17.29-amd64.deb

wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.17.29-amd64.deb.sha512

shasum -a 512 -c elasticsearch-7.17.29-amd64.deb.sha512

sudo dpkg -i elasticsearch-7.17.29-amd64.deb

ensure ES is stopped before touching plugins

sudo systemctl stop elasticsearch

sudo systemctl daemon-reload

7.x: ingest-attachment IS a plugin → must match ES version

sudo /usr/share/elasticsearch/bin/elasticsearch-plugin remove ingest-attachment || true

sudo /usr/share/elasticsearch/bin/elasticsearch-plugin install ingest-attachment

sudo systemctl start elasticsearch


2) Upgrade to 8.19.12

wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-8.19.12-amd64.deb

wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-8.19.12-amd64.deb.sha512

shasum -a 512 -c elasticsearch-8.19.12-amd64.deb.sha512

sudo dpkg -i elasticsearch-8.19.12-amd64.deb

sudo systemctl stop elasticsearch

sudo systemctl daemon-reload

IMPORTANT: remove any old plugin leftovers (7.x plugin dir must not remain)

sudo rm -rf /usr/share/elasticsearch/plugins/ingest-attachment

sudo rm -rf /usr/share/elasticsearch/plugins/.installing-*

sudo systemctl start elasticsearch


3) Upgrade to 9.3.1

wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-9.3.1-amd64.deb

wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-9.3.1-amd64.deb.sha512

shasum -a 512 -c elasticsearch-9.3.1-amd64.deb.sha512

sudo dpkg -i elasticsearch-9.3.1-amd64.deb

sudo systemctl stop elasticsearch

sudo systemctl daemon-reload

sudo mv /var/lib/elasticsearch /var/lib/elasticsearch.bak

sudo mkdir /var/lib/elasticsearch

sudo chown -R elasticsearch:elasticsearch /var/lib/elasticsearch

sudo systemctl start elasticsearch


4) Generate Password for Zammad

sudo /usr/share/elasticsearch/bin/elasticsearch-reset-password -u elastic


5) Set Elastichsearch Password for Zammad on zammad-web

Now you need your password which was shown during the installation.

Set Elasticsearch user:

sudo zammad run rails r “Setting.set(‘es_user’, ‘elastic’)”

Set Elasticsearch password. Replace <password> with the one you got during the installation of Elasticsearch. In case you need to create a new password, run /usr/share/elasticsearch/bin/elasticsearch-reset-password -u elastic.

sudo zammad run rails r “Setting.set(‘es_password’, ‘’)”

sudo zammad run rake zammad:searchindex:rebuild[4]

sudo zammad run rails r "Setting.set(‘es_attachment_ignore’,\

[ ‘.png’, ‘.jpg’, ‘.jpeg’, ‘.mpeg’, ‘.mpg’, ‘.mov’, ‘.bin’, ‘.exe’, ‘.box’, ‘.mbox’ ] )"

sudo zammad run rails r “Setting.set(‘es_attachment_max_size_in_mb’, 50)”