Many catalogue and publisher websites run on an Elasticsearch cluster that someone set up years ago. It works, mostly. The developer who built it has left, the version is out of support, and a security scan has flagged it. Everyone agrees it should be upgraded, and nobody wants to be the one who breaks search on the live site.
This is the approach we use to upgrade search on older sites without downtime and without surprises.
Know what you are running
Start with three facts:
GET /
GET _cat/indices?v&h=index,docs.count,store.size,creation.date.string
GET _cat/nodes?v&h=name,version,heap.percent,disk.used_percent
The first gives the version. The second lists every index and when it was created; this matters, because Elasticsearch can only read indices created by the previous major version. The third shows the nodes and their health.
Then find the client: which library and version the website uses to talk to Elasticsearch (on PHP sites, often an old elasticsearch/elasticsearch package or plain cURL calls).
Why not upgrade in place?
The official path from an old version goes through every major version:
- 5.x to 5.6, then to 6.8;
- 6.8 to 7.17;
- 7.17 to 8.x, then 8.19 to 9.x.
At each major step, indices created two versions back must be reindexed first, mapping types disappear (7.0), and security becomes mandatory (8.0). On a small site cluster with no test environment, that is several risky steps with the live search in the middle.
For search on a website, there is usually an easier way: the index can be rebuilt from your product database or copied from the old cluster.
The side-by-side upgrade
1. Build a new cluster on a current version
Same mappings and analyzers, updated for the new version: remove mapping types, replace removed settings, and switch on security with TLS and a dedicated user for the website. This is also the moment to fix known search problems, such as codes and ISBNs or zero-result searches.
2. Copy the data
If the website can reindex from its own database, use that. Otherwise, copy straight from the old cluster with reindex from remote, which reads from much older versions:
POST _reindex
{
"source": {
"remote": { "host": "http://old-search.internal:9200" },
"index": "products"
},
"dest": { "index": "products-v2" }
}
Add the old host to reindex.remote.whitelist in elasticsearch.yml on the new cluster first. Point an alias, such as products, at the new index, so the website never uses an index name with a version in it.
3. Replay real searches on both clusters
Take the last few weeks of searches from your logs and run each one against both the old and the new cluster. Compare:
- the number of results;
- the top 10 product IDs;
- the response time.
Most queries should return the same or better results. Look at every query where the top results changed, and decide whether the new order is better or a regression. This step is what turns an upgrade from a gamble into a checked change.
4. Update the client
Newer Elasticsearch versions need newer client libraries. Two things make this easier:
- REST API compatibility: Elasticsearch 8 accepts 7.x-style requests when the client sends a
compatible-with=7header, so a 7.x client can often keep working while you update the code. - Credentials and TLS: the new cluster requires them. The website's configuration needs a username and password or an API key, and the CA certificate.
Test the whole site against the new cluster in a staging environment: search, autocomplete, filters, and anything that writes to the index.
5. Switch, and keep the way back open
Switch the website's search connection to the new cluster with a configuration change you can reverse in minutes. Keep the old cluster running, read-only, for a week or two. If something goes wrong, switch back. When nothing has gone wrong, shut it down.
How long it takes
For a typical catalogue site with one or two indices and a few hundred thousand products, the work is usually one to three weeks, most of it in testing. The switch itself takes minutes.
Elasticsearch or OpenSearch?
If your cluster is on 7.10 or earlier, OpenSearch is also an option, and the move is similar. See Elasticsearch vs OpenSearch for the trade-offs. They apply to publishers as well as banks.
We upgrade search for publishers and catalogue sites running custom or older platforms, working alongside your developer or agency. See catalogue search for publishers and Elasticsearch upgrade services.
