Updating indexes efficiently

When upserting a design doc it looks like every index in that document gets re-indexed, is that correct?

And if so, is there a way to have couchbase only reindex (or index) changed (or new) views within that design document?

Or is the only way to achieve this to put each view in it’s own design doc. Would there be any drawbacks to this approach?

Does anyone at couchbase have an answer?

Is it possible to update a single view in a design document without all indexes in the document getting re-indexed?

And if not, is there a downside to putting each view into it’s own design doc?


A design document represents a collection of indexing instructions that are applied to all document mutations together. This batching ensures the documents are iterated over (and mutations observed) only once, regardless of the number of views that are present in the design document.

Because the mutations are read only once, it is not possible to modify one view of a design document. It is the design doc as a whole that is observing the mutations, and not the view individually.

It is possible to batch views into design docs in any manner that is best for a given use case. The tradeoff of putting many views is the relative inflexibility that brings as observed here, and the tradeoff putting them into individual design docs is that mutations are processed individually by each design doc and so is more expensive in terms of CPU utilization.

Thats a great answer, thank you Siri.

In terms of performance, is putting each index in its own design doc generally a really really bad idea? Or is a pattern that suits some projects but not others?