Company
Date Published
Author
Don Pinto, Principal Product Manager, Couchbase
Word count
531
Language
English
Hacker News points
None

Summary

Couchbase Server provides different ways for applications to access data, including basic key-value operations, secondary indexes, and full-text search, each suited for specific scenarios. Secondary indexes, defined using JavaScript views with map and optional reduce functions, are ideal for quick key-based lookups and range queries, such as listing product names in a catalog. They use a B-tree data structure and offer eventual consistency with the stored documents. In contrast, full-text search is suitable for searching large volumes of textual data, as it maps document terms to document IDs, enabling efficient ad-hoc queries across the dataset. Couchbase integrates with Elasticsearch for real-time document replication and full-text indexing, allowing keyword-based searches, such as finding products with attributes like "red." While full-text search is recommended for term-based search and human consumption, secondary indexes are better for machine/programmatic consumption.