The method of storage of information into the Couchbase Server affects how and when the indexing information is built, and when data written to the cluster is incorporated into the indexes. In addition, the indexing of data is also affected by the view system and the settings used when the view is accessed.
The basic storage and indexing sequence is:
A document is stored within the cluster. Initially the document is stored only in RAM.
The document is persisted to disk through the standard disk write queue mechanism.
Once the document has been persisted to disk, the document can be indexed by the view mechanism.
This sequence means that the view results are eventually consistent with what is stored in memory based on whether documents have been persisted to disk. It is possible to write a document to the cluster, and access the index, without the newly written document appearing in the generated view index.
Conversely, documents that have been stored with an expiry may continue to be included within the view index until the document has been removed from the database by the expiry pager.
Couchbase Server supports the Observe command, which enables the current state of a document and whether the document has been persisted to disk and/or whether it has been considered for inclusion in an index.
When accessing a view, the contents of the view are asynchronous
to the stored documents. In addition, the creation and updating
of the view is subject to the
This controls how and when the view is updated when the view
content is queried. For more information, see
Section 9.2.4, “Index Updates and the
stale Parameter”. Views can also
be automatically updated on a schedule so that their data is not
too out of sync with stored documents. For more information, see
Section 9.2.5, “Automated Index Updates”.