Best practice for creating views?

Hello,

When I create a view, I have to create a document and then create a view under the document. I also noticed that there is no option to publish an individual view to production views. I always have to publish all the views in a document.

What are the best practices to create views?

Should I create just one view per document or is it okay to create multiple views under the same document?

I guess my question is, what happens when I publish a view from dev to prod? Does the couchbase server re-index everything even though a view (map and reduce) hasn’t changed at all?

All views under the design document gets indexed if any one of the view definitions under the design doc has changed when you publish a design document. The organization of design document vs views is dependent on a few factors. Design documents are there mainly for the efficiency of the indexing process so an update can be processed once and applied to many indexes at the same time. Creating too many design document will have some more overhead in processing mutations because we will process mutations per design document independently.
thanks
-cihan

Thank you cihan.

So If I have 4 views in a document and then change one of them in my dev then publish the document to production, what happens? Do all four views get re-indexed?

How do I determine when to create a document?