Production Views

Production Views

Production views are used in a deployed environment.

Due to the nature of the Couchbase cluster and because of the size of the datasets that can be stored across a cluster, the impact of view development needs to be controlled. Creating a view implies the creation of the index which could slow down the performance of your server while the index is being generated. However, views also need to be built and developed using the actively stored information.

To support both the creation and testing of views, and the deployment of views in production, Couchbase Server supports two different view types, Development views and Production views. The two view types work identically, but have different purposes and restrictions placed upon their operation.

  • Production views

Production views are optimized for production use. A production view has the following attributes:

  • Production views always operate on the full dataset for their respective bucket.
  • Production views can either be created from the Web Console or through REST API. From the Web Console, you first create development views and then publish them as production views. Through REST API, you directly create the production views (and skip the initial development views).
  • Production views cannot be modified through the UI. You can only access the information exposed through a production view. To make changes to a production view, it must be copied to a development view, edited, and re-published.

Views can be updated by the REST API, but updating a production design document immediately invalidates all of the views defined within it.

  • Production views are accessed through a different URL to development views.

The support for the two different view types means that there is a typical work flow for view development, as shown in the figure below:

The above diagram features the following steps:

  1. Create a development view and view the sample view output.
  2. Refine and update your view definition to suit your needs, repeating the process until your view is complete. During this phase you can access your view from your client library and application to ensure it suits your needs.
  3. Once the view definition is complete, apply your view to your entire Cluster dataset.
  4. Push your development view into production. This moves the view from development into production, and renames the index (so that the index does not need to be rebuilt).
  5. Start using your production view.

Individual views are created as part of a design document. Each design document can have multiple views, and each Couchbase bucket can have multiple design documents. You can therefore have both development and production views within the same bucket while you development different indexes on your data.

For information on publishing a view from development to production state.