diff --git a/src/oss/javascript/integrations/providers/all_providers.mdx b/src/oss/javascript/integrations/providers/all_providers.mdx
index 5f305b01d..a852fd587 100644
--- a/src/oss/javascript/integrations/providers/all_providers.mdx
+++ b/src/oss/javascript/integrations/providers/all_providers.mdx
@@ -865,10 +865,17 @@ Browse the complete collection of integrations available for JavaScript/TypeScri
+ Recommended vector search method in Couchbase NoSQL database via query service.
+
+
+
- NoSQL database with vector search capabilities.
+ Alternative vector search method in Couchbase NoSQL database via search service.
+ This functionality is only available in [Couchbase 8.0](https://docs.couchbase.com/server/8.0/introduction/whats-new.html) and above.
+
+
+## Key differences from `CouchbaseSearchVectorStore`
+
+(formerly `CouchbaseVectorStore`)
+
+- **Query and Index Service**: Uses Couchbase's Query service with SQL++ instead of the Search service
+- **No Index Required**: Does not require a pre-configured search index for basic operations
+- **SQL++ Syntax**: Supports WHERE clauses and SQL++ query syntax for filtering
+- **Vector Functions**: Uses `APPROX_VECTOR_DISTANCE` function for similarity calculations
+- **Distance Strategies**: Supports multiple distance strategies (Dot Product, Cosine, Euclidean, Euclidean Squared)
+
+## Installation
+
+```bash npm
+npm install couchbase @langchain/openai @langchain/community @langchain/core
+```
+
+## Create Couchbase connection object
+
+We create a connection to the Couchbase cluster and then pass the cluster object to the Vector Store. Here, we are connecting using the username and password.
+You can also connect to your cluster using any other supported method.
+
+For more information on connecting to the Couchbase cluster, please check the [Node SDK documentation](https://docs.couchbase.com/nodejs-sdk/current/hello-world/start-using-sdk.html#connect).
+
+```typescript
+import { Cluster } from "couchbase";
+
+const connectionString = "couchbase://localhost";
+const dbUsername = "Administrator"; // valid database user with read access to the bucket being queried
+const dbPassword = "Password"; // password for the database user
+
+const couchbaseClient = await Cluster.connect(connectionString, {
+ username: dbUsername,
+ password: dbPassword,
+ configProfile: "wanDevelopment",
+});
+```
+
+## Basic setup
+
+```typescript
+import { CouchbaseQueryVectorStore, DistanceStrategy } from "@langchain/community/vectorstores/couchbase_query";
+import { OpenAIEmbeddings } from "@langchain/openai";
+import { Cluster } from "couchbase";
+
+// Connect to Couchbase
+const cluster = await Cluster.connect("couchbase://localhost", {
+ username: "Administrator",
+ password: "password",
+});
+
+// Initialize embeddings
+const embeddings = new OpenAIEmbeddings();
+
+// Configure the vector store
+const vectorStore = await CouchbaseQueryVectorStore.initialize(embeddings, {
+ cluster,
+ bucketName: "my-bucket",
+ scopeName: "my-scope",
+ collectionName: "my-collection",
+ textKey: "text", // optional, defaults to "text"
+ embeddingKey: "embedding", // optional, defaults to "embedding"
+ distanceStrategy: DistanceStrategy.COSINE, // optional, defaults to DOT
+});
+```
+
+## Creating vector indexes
+
+The Query vector store supports creating vector indexes to improve search performance. There are two types of indexes available:
+
+### Hyperscale index
+A specialized vector index optimized for vector operations using Couchbase's vector indexing capabilities:
+
+```typescript
+import { IndexType } from "@langchain/community/vectorstores/couchbase_query";
+
+await vectorStore.createIndex({
+ indexType: IndexType.HYPERSCALE,
+ indexDescription: "IVF,SQ8",
+ indexName: "my_vector_index", // optional
+ vectorDimension: 1536, // optional, auto-detected from embeddings
+ distanceMetric: DistanceStrategy.COSINE, // optional, uses store default
+ fields: ["text", "metadata"], // optional, defaults to text field
+ whereClause: "type = 'document'", // optional filter
+ indexScanNprobes: 10, // optional tuning parameter
+ indexTrainlist: 1000, // optional tuning parameter
+});
+```
+
+**Generated SQL++:**
+```sql
+CREATE VECTOR INDEX `my_vector_index` ON `bucket`.`scope`.`collection`
+(`embedding` VECTOR) INCLUDE (`text`, `metadata`)
+WHERE type = 'document' USING GSI WITH {'dimension': 1536, 'similarity': 'cosine', 'description': 'IVF,SQ8'}
+```
+
+### Composite index
+A general-purpose GSI index that includes vector fields alongside scalar fields:
+
+```typescript
+await vectorStore.createIndex({
+ indexType: IndexType.COMPOSITE,
+ indexDescription: "IVF1024,SQ8",
+ indexName: "my_composite_index",
+ vectorDimension: 1536,
+ fields: ["text", "metadata.category"],
+ whereClause: "created_date > '2023-01-01'",
+ indexScanNprobes: 3,
+ indexTrainlist: 10000,
+});
+```
+
+**Generated SQL++:**
+```sql
+CREATE INDEX `my_composite_index` ON `bucket`.`scope`.`collection`
+(`text`, `metadata.category`, `embedding` VECTOR)
+WHERE created_date > '2023-01-01' USING GSI
+WITH {'dimension': 1536, 'similarity': 'dot', 'description': 'IVF1024,SQ8', 'scan_nprobes': 3, 'trainlist': 10000}
+```
+
+### Key differences
+
+| Aspect | Hyperscale Index | Composite Index |
+|--------|-------------|-----------------|
+| **SQL++ Syntax** | `CREATE VECTOR INDEX` | `CREATE INDEX` |
+| **Vector Field** | `(field VECTOR)` with `INCLUDE` clause | `(field1, field2, vector_field VECTOR)` |
+| **Vector Parameters** | Supports all vector parameters | Supports all vector parameters |
+| **Optimization** | Specialized for vector operations | General-purpose GSI with vector support |
+| **Use Case** | Pure vector similarity search | Mixed vector and scalar queries |
+| **Performance** | Optimized for vector distance calculations | Good for hybrid queries |
+| **Tuning Parameters** | Supports `indexScanNprobes`, `indexTrainlist` | Supports `indexScanNprobes`, `indexTrainlist` |
+| **Limitations** | Only one vector field, uses INCLUDE for other fields | One vector field among multiple index keys |
+
+## Basic vector search example
+
+The following example showcases how to use Couchbase Query vector search and perform similarity search.
+
+```typescript
+import { OpenAIEmbeddings } from "@langchain/openai";
+import {
+ CouchbaseQueryVectorStore,
+ DistanceStrategy,
+} from "@langchain/community/vectorstores/couchbase_query";
+import { Cluster } from "couchbase";
+import { Document } from "@langchain/core/documents";
+
+const connectionString = process.env.COUCHBASE_DB_CONN_STR ?? "couchbase://localhost";
+const databaseUsername = process.env.COUCHBASE_DB_USERNAME ?? "Administrator";
+const databasePassword = process.env.COUCHBASE_DB_PASSWORD ?? "Password";
+
+const couchbaseClient = await Cluster.connect(connectionString, {
+ username: databaseUsername,
+ password: databasePassword,
+ configProfile: "wanDevelopment",
+});
+
+// OpenAI API Key is required to use OpenAIEmbeddings
+const embeddings = new OpenAIEmbeddings({
+ apiKey: process.env.OPENAI_API_KEY,
+});
+
+const vectorStore = await CouchbaseQueryVectorStore.initialize(embeddings, {
+ cluster: couchbaseClient,
+ bucketName: "testing",
+ scopeName: "_default",
+ collectionName: "_default",
+ textKey: "text",
+ embeddingKey: "embedding",
+ distanceStrategy: DistanceStrategy.COSINE,
+});
+
+// Add documents
+const documents = [
+ new Document({
+ pageContent: "Couchbase is a NoSQL database",
+ metadata: { category: "database", type: "document" }
+ }),
+ new Document({
+ pageContent: "Vector search enables semantic similarity",
+ metadata: { category: "ai", type: "document" }
+ })
+];
+
+await vectorStore.addDocuments(documents);
+
+// Perform similarity search
+const query = "What is a NoSQL database?";
+const results = await vectorStore.similaritySearch(query, 4);
+console.log("Search results:", results[0]);
+
+// Search with scores
+const resultsWithScores = await vectorStore.similaritySearchWithScore(query, 4);
+console.log("Document:", resultsWithScores[0][0]);
+console.log("Score:", resultsWithScores[0][1]);
+```
+
+## Searching documents
+
+### Basic similarity search
+
+```typescript
+// Basic similarity search
+const results = await vectorStore.similaritySearch(
+ "What is a NoSQL database?",
+ 4
+);
+```
+
+### Search with filters
+
+```typescript
+// Search with filters
+const filteredResults = await vectorStore.similaritySearch(
+ "database technology",
+ 4,
+ {
+ where: "metadata.category = 'database'",
+ fields: ["text", "metadata.category"]
+ }
+);
+```
+
+### Search with scores
+
+```typescript
+// Search with scores
+const resultsWithScores = await vectorStore.similaritySearchWithScore(
+ "vector search capabilities",
+ 4
+);
+```
+
+### Complex filtering
+
+```typescript
+const results = await vectorStore.similaritySearch(
+ "search query",
+ 10,
+ {
+ where: "metadata.category IN ['tech', 'science'] AND metadata.rating >= 4",
+ fields: ["content", "metadata.title", "metadata.rating"]
+ }
+);
+```
+
+## Configuration options
+
+### Distance strategies
+
+- `DistanceStrategy.DOT` - [Dot Product](https://docs.couchbase.com/server/current/vector-index/vectors-and-indexes-overview.html#dot) (default)
+- `DistanceStrategy.COSINE` - [Cosine Similarity](https://docs.couchbase.com/server/current/vector-index/vectors-and-indexes-overview.html#cosine)
+- `DistanceStrategy.EUCLIDEAN` - [Euclidean Distance](https://docs.couchbase.com/server/current/vector-index/vectors-and-indexes-overview.html#euclidean) (also known as L2)
+- `DistanceStrategy.EUCLIDEAN_SQUARED` - [Euclidean Squared Distance](https://docs.couchbase.com/server/current/vector-index/vectors-and-indexes-overview.html#euclidean-squared) (also known as L2 Squared)
+
+### Index types
+
+- `IndexType.HYPERSCALE` - Specialized vector index for optimal vector search performance
+- `IndexType.COMPOSITE` - General-purpose index that can include vector and scalar fields
+
+## Advanced usage
+
+### Custom vector fields
+
+```typescript
+const vectorStore = await CouchbaseQueryVectorStore.initialize(embeddings, {
+ cluster,
+ bucketName: "my-bucket",
+ scopeName: "my-scope",
+ collectionName: "my-collection",
+ textKey: "content",
+ embeddingKey: "vector_embedding",
+ distanceStrategy: DistanceStrategy.EUCLIDEAN,
+});
+```
+
+### Creating from Texts
+
+```typescript
+const texts = [
+ "Couchbase is a NoSQL database",
+ "Vector search enables semantic similarity"
+];
+
+const metadatas = [
+ { category: "database" },
+ { category: "ai" }
+];
+
+const vectorStore = await CouchbaseQueryVectorStore.fromTexts(
+ texts,
+ metadatas,
+ embeddings,
+ {
+ cluster,
+ bucketName: "my-bucket",
+ scopeName: "my-scope",
+ collectionName: "my-collection"
+ }
+);
+```
+
+### Deleting documents
+
+```typescript
+const documentIds = ["doc1", "doc2", "doc3"];
+await vectorStore.delete({ ids: documentIds });
+```
+
+## Performance considerations
+
+1. **Create Indexes**: Use `createIndex()` to create appropriate vector indexes for better performance
+2. **Choose Index Type**:
+ - Use **Hyperscale indexes** for pure vector search workloads where you primarily perform similarity searches
+ - Use **Composite indexes** for mixed queries that combine vector similarity with scalar field filtering
+3. **Tune Parameters**: Adjust `indexScanNprobes` and `indexTrainlist` based on your data size and performance requirements
+4. **Filter Early**: Use WHERE clauses to reduce the search space before vector calculations
+
+## Error handling
+
+```typescript
+try {
+ await vectorStore.createIndex({
+ indexType: IndexType.HYPERSCALE,
+ indexDescription: "IVF,SQ8",
+ });
+} catch (error) {
+ console.error("Index creation failed:", error.message);
+}
+```
+
+### Common errors
+
+#### Insufficient training data
+If you see errors related to insufficient training data, you may need to:
+- Increase the `indexTrainlist` parameter (default recommendation: ~50 vectors per centroid)
+- Ensure you have enough documents with vector embeddings in your collection
+- For collections with < 1 million vectors, use `number_of_vectors / 1000` for centroids
+- For larger collections, use `sqrt(number_of_vectors)` for centroids
+
+## Comparison with `CouchbaseSearchVectorStore`
+
+| Feature | `CouchbaseQueryVectorStore` | `CouchbaseSearchVectorStore` |
+|---------|---------------------------|----------------------|
+| Service | Query (SQL++) | Search (FTS) |
+| Index Required | Optional (for performance) | Required |
+| Query Language | SQL++ WHERE clauses | Search query syntax |
+| Vector Functions | APPROX_VECTOR_DISTANCE | VectorQuery API |
+| Setup Complexity | Lower | Higher |
+| Performance | Good with indexes | Optimized for search |
+
+## Frequently Asked Questions
+
+### Do I need to create an index before using `CouchbaseQueryVectorStore`?
+
+No, unlike the Search-based `CouchbaseSearchVectorStore`, the Query-based implementation can work without pre-created indexes. However, creating appropriate vector indexes (Hyperscale or Composite) will significantly improve query performance.
+
+### When should I use Hyperscale vs. Composite indexes?
+
+- Use **Hyperscale indexes** when you primarily perform vector similarity searches with minimal filtering on other fields
+- Use **Composite indexes** when you frequently combine vector similarity with filtering on scalar fields in the same query
+- Learn more about how to [Choose the Right Vector Index](https://docs.couchbase.com/server/current/vector-index/use-vector-indexes.html)
+
+### Can I use both `CouchbaseQueryVectorStore` and `CouchbaseSearchVectorStore` on the same data?
+
+Yes, both can work on the same document structure. However, they use different services (Search vs Query) and have different indexing requirements.
+
+## Related
+
+- Vector store [conceptual guide](/oss/integrations/vectorstores)
+- Vector store [how-to guides](/oss/integrations/vectorstores)
diff --git a/src/oss/javascript/integrations/vectorstores/couchbase.mdx b/src/oss/javascript/integrations/vectorstores/couchbase_search.mdx
similarity index 92%
rename from src/oss/javascript/integrations/vectorstores/couchbase.mdx
rename to src/oss/javascript/integrations/vectorstores/couchbase_search.mdx
index 20151f9c6..51e236299 100644
--- a/src/oss/javascript/integrations/vectorstores/couchbase.mdx
+++ b/src/oss/javascript/integrations/vectorstores/couchbase_search.mdx
@@ -1,13 +1,10 @@
---
-title: Couchbase
+title: Couchbase Search Vector Store
---
-[Couchbase](http://couchbase.com/) is an award-winning distributed NoSQL cloud database that delivers unmatched versatility, performance, scalability, and financial value for all of your cloud, mobile,
-AI, and edge computing applications. Couchbase embraces AI with coding assistance for developers and vector search for their applications.
+The `CouchbaseSearchVectorStore` is an implementation of Vector Search that is a part of the [Full Text Search Service](https://docs.couchbase.com/server/current/learn/services-and-indexes/services/search-service.html) (Search Service) in Couchbase.
-Vector Search is a part of the [Full Text Search Service](https://docs.couchbase.com/server/current/learn/services-and-indexes/services/search-service.html) (Search Service) in Couchbase.
-
-This tutorial explains how to use Vector Search in Couchbase. You can work with both [Couchbase Capella](https://www.couchbase.com/products/capella/) and your self-managed Couchbase Server.
+This tutorial explains how to use Vector Search via the Couchbase Search Service. You can work with both [Couchbase Capella](https://www.couchbase.com/products/capella/) and your self-managed Couchbase Server.
## Installation
@@ -16,7 +13,7 @@ You will need couchbase and langchain community to use couchbase vector store. F
```bash npm
npm install couchbase @langchain/openai @langchain/community @langchain/core
```
-## Create Couchbase Connection Object
+## Create Couchbase connection object
We create a connection to the Couchbase cluster initially and then pass the cluster object to the Vector Store. Here, we are connecting using the username and password.
You can also connect using any other supported way to your cluster.
@@ -36,7 +33,7 @@ const couchbaseClient = await Cluster.connect(connectionString, {
configProfile: "wanDevelopment",
});
```
-## Create the Search Index
+## Create the search index
Currently, the Search index needs to be created from the Couchbase Capella or Server UI or using the REST interface.
@@ -46,7 +43,7 @@ Let us define a Search index with the name `vector-index` on the testing bucket.
We are defining an index on the `testing` bucket's `_default` scope on the `_default` collection with the vector field set to `embedding` with 1536 dimensions and the text field set to `text`.
We are also indexing and storing all the fields under `metadata` in the document as a dynamic mapping to account for varying document structures. The similarity metric is set to `dot_product`.
-### How to Import an Index to the Full Text Search service?
+### How to import an index to the full text search service?
- [Couchbase Server](https://docs.couchbase.com/server/current/search/import-search-index.html)
- Click on Search -> Add Index -> Import
@@ -57,7 +54,7 @@ We are also indexing and storing all the fields under `metadata` in the document
- Import the file in Capella using the instructions in the documentation.
- Click on Create Index to create the index.
-### Index Definition
+### Index definition
```json
{
@@ -160,9 +157,9 @@ const store = await CouchbaseVectorStore.initialize(
couchbaseConfig
);
```
-## Basic Vector Search Example
+## Basic vector search example
-The following example showcases how to use couchbase vector search and perform similarity search.
+The following example showcases how to use couchbase vector search via the Search Service and perform similarity search.
For this example, we are going to load the "state_of_the_union.txt" file via the TextLoader,
chunk the text into 500 character chunks with no overlaps and index all these chunks into Couchbase.
@@ -239,7 +236,7 @@ const result = await store.similaritySearch(query, 1, {
});
console.log(result[0]);
```
-## Specifying Fields to Return
+## Specifying fields to return
You can specify the fields to return from the document using `fields` parameter in the filter during searches.
These fields are returned as part of the `metadata` object. You can fetch any field that is stored in the index.
@@ -256,7 +253,7 @@ const result = await store.similaritySearch(query, 1, {
});
console.log(result[0]);
```
-## Hybrid Search
+## Hybrid search
Couchbase allows you to do hybrid searches by combining vector search results with searches on non-vector fields of the document like the `metadata` object.
@@ -266,7 +263,7 @@ The scores of each of the component searches are added up to get the total score
To perform hybrid searches, there is an optional key, `searchOptions` in `fields` parameter that can be passed to all the similarity searches.
The different search/query possibilities for the `searchOptions` can be found [here](https://docs.couchbase.com/server/current/search/search-request-params.html#query-object).
-### Create Diverse Metadata for Hybrid Search
+### Create diverse metadata for hybrid search
In order to simulate hybrid search, let us create some random metadata from the existing documents.
We uniformly add three fields to the metadata, `date` between 2010 & 2020, `rating` between 1 & 5 and `author` set to either John Doe or Jane Doe.
@@ -288,7 +285,7 @@ const store = await CouchbaseVectorStore.fromDocuments(
const query = "What did the president say about Ketanji Brown Jackson";
const independenceQuery = "Any mention about independence?";
```
-### Example: Search by Exact Value
+### Example: Search by exact value
We can search for exact matches on a textual field like the author in the `metadata` object.
@@ -301,7 +298,7 @@ const exactValueResult = await store.similaritySearch(query, 4, {
});
console.log(exactValueResult[0]);
```
-### Example: Search by Partial Match
+### Example: Search by partial match
We can search for partial matches by specifying a fuzziness for the search. This is useful when you want to search for slight variations or misspellings of a search query.
@@ -316,7 +313,7 @@ const partialMatchResult = await store.similaritySearch(query, 4, {
});
console.log(partialMatchResult[0]);
```
-### Example: Search by Date Range Query
+### Example: Search by date range query
We can search for documents that are within a date range query on a date field like `metadata.date`.
@@ -335,7 +332,7 @@ const dateRangeResult = await store.similaritySearch(independenceQuery, 4, {
});
console.log(dateRangeResult[0]);
```
-### Example: Search by Numeric Range Query
+### Example: Search by numeric range query
We can search for documents that are within a range for a numeric field like `metadata.rating`.
@@ -354,7 +351,7 @@ const ratingRangeResult = await store.similaritySearch(independenceQuery, 4, {
});
console.log(ratingRangeResult[0]);
```
-### Example: Combining Multiple Search Conditions
+### Example: Combining multiple search conditions
Different queries can by combined using AND (conjuncts) or OR (disjuncts) operators.
@@ -375,7 +372,7 @@ const multipleConditionsResult = await store.similaritySearch(texts[0], 4, {
console.log(multipleConditionsResult[0]);
```
-### Other Queries
+### Other queries
Similarly, you can use any of the supported Query methods like Geo Distance, Polygon Search, Wildcard, Regular Expressions, etc in the `searchOptions` Key of `filter` parameter.
Please refer to the documentation for more details on the available query methods and their syntax.
diff --git a/src/oss/javascript/integrations/vectorstores/index.mdx b/src/oss/javascript/integrations/vectorstores/index.mdx
index 3ff4af49a..95190cba8 100644
--- a/src/oss/javascript/integrations/vectorstores/index.mdx
+++ b/src/oss/javascript/integrations/vectorstores/index.mdx
@@ -685,9 +685,16 @@ LangChain.js integrates with a variety of vector stores. You can check out a ful
cta="View guide"
/>
+