You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/oss/javascript/integrations/vectorstores/couchbase_query.mdx
+24-29Lines changed: 24 additions & 29 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,17 +2,17 @@
2
2
title: Couchbase Query Vector Store
3
3
---
4
4
5
-
The `CouchbaseQueryVectorStore` is an implementation of Vector Search that uses the [Query Service](https://docs.couchbase.com/server/current/learn/services-and-indexes/services/query-service.html) (SQL++) and [Index Service](https://docs.couchbase.com/server/current/learn/services-and-indexes/services/index-service.html) for vector similarity search instead of the Search service. This provides an alternative approach for vector operations using SQL++ queries with vector functions.
5
+
The `CouchbaseQueryVectorStore` is the preferred implementation of Vector Search in Couchbase. It uses the [Query Service](https://docs.couchbase.com/server/current/learn/services-and-indexes/services/query-service.html) (SQL++) and [Index Service](https://docs.couchbase.com/server/current/learn/services-and-indexes/services/index-service.html) for vector similarity search, instead of the Search service. This provides a more powerful and straightforward approach for vector operations using SQL++ queries with vector functions.
6
6
7
7
More information about Couchbase's vector search capabilities can be found in the official documentation: [Choose the Right Vector Index](https://docs.couchbase.com/server/current/vector-index/use-vector-indexes.html).
8
8
9
-
<Note>
10
-
This functionality is only available in Couchbase Server 8.0 and above, which introduced vector search capabilities in the Query service.
11
-
</Note>
9
+
<Warning>
10
+
This functionality is only available in Couchbase Server 8.0 and above.
11
+
</Warning>
12
12
13
-
## Key Differences from CouchbaseVectorStore
13
+
## Key Differences from `CouchbaseSearchVectorStore` (formerly `CouchbaseVectorStore`)
14
14
15
-
-**Query Service**: Uses Couchbase's Query service with SQL++ instead of the Search service
15
+
-**Query and Index Service**: Uses Couchbase's Query service with SQL++ instead of the Search service
16
16
-**No Index Required**: Does not require a pre-configured search index for basic operations
17
17
-**SQL++ Syntax**: Supports WHERE clauses and SQL++ query syntax for filtering
18
18
-**Vector Functions**: Uses `APPROX_VECTOR_DISTANCE` function for similarity calculations
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.
30
-
You can also connect using any other supported way to your cluster.
29
+
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.
30
+
You can also connect to your cluster using any other supported method.
31
31
32
32
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).
33
33
34
34
```typescript
35
35
import { Cluster } from"couchbase";
36
36
37
-
const connectionString ="couchbase://localhost";// or couchbases://localhost if you are using TLS
37
+
const connectionString ="couchbase://localhost";
38
38
const dbUsername ="Administrator"; // valid database user with read access to the bucket being queried
39
39
const dbPassword ="Password"; // password for the database user
| Index Required | Optional (for performance) | Required |
@@ -362,21 +359,19 @@ If you see errors related to insufficient training data, you may need to:
362
359
| Setup Complexity | Lower | Higher |
363
360
| Performance | Good with indexes | Optimized for search |
364
361
365
-
<br />
366
-
<br />
362
+
## Frequently Asked Questions
367
363
368
-
#Frequently Asked Questions
364
+
### Do I need to create an index before using `CouchbaseQueryVectorStore`?
369
365
370
-
## Question: Do I need to create an index before using CouchbaseQueryVectorStore?
366
+
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.
371
367
372
-
No, unlike the Search-based CouchbaseVectorStore, the Query-based implementation can work without pre-created indexes. However, creating appropriate vector indexes (HYPERSCALE or COMPOSITE) will significantly improve query performance.
368
+
### When should I use Hyperscale vs. Composite indexes?
373
369
374
-
## Question: When should I use HYPERSCALE vs COMPOSITE indexes?
370
+
- Use **Hyperscale indexes** when you primarily perform vector similarity searches with minimal filtering on other fields
371
+
- Use **Composite indexes** when you frequently combine vector similarity with filtering on scalar fields in the same query
372
+
- Learn more about how to [Choose the Right Vector Index](https://docs.couchbase.com/server/current/vector-index/use-vector-indexes.html)
375
373
376
-
- Use **HYPERSCALE indexes** when you primarily perform vector similarity searches with minimal filtering on other fields
377
-
- Use **COMPOSITE indexes** when you frequently combine vector similarity with filtering on scalar fields in the same query
378
-
379
-
## Question: Can I use both CouchbaseVectorStore and CouchbaseQueryVectorStore on the same data?
374
+
### Can I use both `CouchbaseQueryVectorStore` and `CouchbaseSearchVectorStore` on the same data?
380
375
381
376
Yes, both can work on the same document structure. However, they use different services (Search vs Query) and have different indexing requirements.
0 commit comments