Oussama EL
Oussama EL

Reputation: 154

Upgrade Elastic Search 1.7 to a newer version

We are preparing to upgrade Elastic Search 1.7 to a newer version.

What we should be caring of before starting the upgrade, also is there any suggestions about the version that we should upgrade to it?

Is it technically possible to upgrade from 1.7 to 5.x or we should upgrade to 2.x first?

Upvotes: 0

Views: 198

Answers (1)

orangejulius
orangejulius

Reputation: 1029

Having been through this recently, there are two approaches to Elasticsearch upgrades when you're far behind:

Take a leap and do it all at once, or take it one major version at a time.

The latter is probably safer, but slower. It's possible due to Elasticsearch's very nice compatibility policy: any breaking changes in major version X will throw a deprecation warning in version X-1, but will continue to work.

Personally I'd recommend taking it one version at a time, and since that approach is more complicated, I'll describe it in a bit more detail.

This allows for a pattern like the following:

  1. Fix all deprecation warnings on version 1
  2. Test on version 2, and when satisfied roll out to production. If there are issues you can always roll back to version 2 (however you will have to create a new index from scratch)
  3. Fix all deprecation warnings on version 2
  4. Test and upgrade to version 5 (there was no 3 or 4)
  5. etc... on through all the versions if you'd like

Here's some general principles that are worth considering

Rebuild indicies from scratch for new versions

Yes, the docs say that, for example, you can load an index created in ES 1.7 into ES2, but I would recommend against it. In my experience, some queries will actually be slower when you do this, even though newer versions of Elasticsearch usually at least maintain if not improve performance.

There are query changes, and schema changes. Treat them accordingly

In general, each update will require some level of change to your Elasticsearch schema mapping, and some changes to your query structure. The query structure is usually much easier to iterate on, since it's in your application code and can be improved or rolled back at any time. Schema changes are harder, since they generally require you to create a new index from scratch and migrate over somehow.

However, just keep in mind that both types of changes exist. Simply adjusting your Elasticsearch schema until it works on the new version, and failing to update your queries can lead to surprises!

Now finally, here's a rough list of the major pain points that I recall from each upgrade

ES 1 -> ES 2

ES 2 -> ES5

  • String datatype has split into text and keyword datatypes
  • TF/IDF scoring replaced with BM25. This one won't require any work on your part but may change the result of some of your queries. In ES5, and especially ES6, BM25 scoring is more configurable, but you may simply not be able to get exactly the same results in ES5 and ES2

Upvotes: 1

Related Questions