View
Table of Contents
Overview


Viewsbelong to adesign document.Design documentsbelong to abucket.Viewnames must be specified using one or moreUTF-8characters.- All the
viewswithin a singledesign documentare updated when the update to a singleviewis triggered. - Expired
documentsmay still exist within the index. Viewsare updated incrementally.Indexqueries are always accessed from disk; Keep some RAM reserved for your operating system to allocate filesystem cache- Mostly,
Viewsare CPU intensive (for indexing) - All
viewsare output in a sorted order according to the content and structure of the key. Keys using a numeric value are sorted numerically, forstrings,UTF-8is used.
How-to
Reference
maxParallelIndexers
- Each
design documentmaps to oneindexer - Couchbase Server limits the maximum number of
indexersthat can run in parallel. - There are two types of indexers:
main indexersandreplica indexers. - Default is
4(main),2(replica) - Can be modified by setting
maxParallelIndexersandmaxParallelReplicaIndexers
Couchbase makes no recommendations for tuning beyond the default settings.
# Check current indexer tasks
curl -X GET -u Administrator:password http://localhost:8092/_active_tasks
# Get / Set maxParallelIndexers
curl -X GET -u Administrator:password http://localhost:8091/settings/maxParallelIndexers
curl -X POST -u Administrator:password http://localhost:8091/settings/maxParallelIndexers -d 'globalValue=8'
# Check current internalSettings
curl -x GET -u Administrator:password http://localhost:8091/internalSettingsTopics
Index updates
stale=ok
- The current index is used as the basis for the query and the results are returned accordingly.

stale=false
- The index is updated before you execute the query
- The response will be delayed until the updated index is available.

stale=updateafter
Indexis marked for updating once the results have been returned to the client

Automated index updates
- At every
updateInterval(default:5000ms), theviewsengine checks if the number of document mutations on disk is greater thanupdateMinChanges(default:5000). If true, it triggers the view update. - If
updateMinChangesis set to0, automatic updates are disabled. - There are also options for replica(like
replicaUpdateMinChanges).
Examples
