Zero downtime re-indexing cloudant search

89 Views Asked by At

I'm trying to understand how the cloudant search index works --specifically, what is the recommended path to do zero-downtime changes to an index. My understanding is, if I e.g. change my production search index, it will be unavailable until Cloudant is done re-indexing with the new index. So what would be the appropriate approach here to avoid this? Should I create a new index and point to it in production when it is done indexing? Does adding a second index impact the availability of the first?

1

There are 1 best solutions below

2
xpqz On

You're correct: changing an index definition renders the index unavailable until the rebuild is complete, which often is somewhat sub-optimal. But there is a way.

Design document (ddoc) management requires a bit of flair to avoid downtime. Best practice is to version your ddocs and build new versions whilst leaving the old version in place. Whilst this avoids downtime, it comes at the cost of having two versions of the same index at the same time. It's a bit of a faff, to be honest, but the ever productive Glynn Bird has written a tool to take the drudgery out of ddoc migration: https://github.com/glynnbird/couchmigrate

Cloudant's docs are quite good on this, too: https://cloud.ibm.com/docs/Cloudant?topic=Cloudant-design-document-management#design-document-management

Disclaimer: I work for Cloudant