Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ To try the examples in this section, you must do the following:
The examples in this section assume that the 3 nodes have the names `svc-dqi-node-001`, `svc-dqi-node-002`, and `svc-dqi-node-003`.
The nodes in your cluster may have different names or IP addresses.

. Install the vector sample data as described in {prerequisites}[Prerequisites].
. Install the `color-vector-sample` data as described in {prerequisites}[Prerequisites].

. Set the query context to the `color` scope in the vector sample dataset.
. Set the query context to the `color` scope in the `color-vector-sample` dataset.
For more information, see xref:n1ql:n1ql-intro/queriesandresults.adoc#query-context[Query Context].

.Create and move an index from one node to another
Expand Down
6 changes: 3 additions & 3 deletions modules/n1ql/pages/n1ql-language-reference/createindex.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -722,7 +722,7 @@ For more examples of indexes where the leading key may be missing, see xref:n1ql
[[ex-create-rgb-idx]]
.Create a Composite Vector index
====
For this example, you must install the vector sample data as described in {prerequisites}[Prerequisites].
For this example, you must install the `color-vector-sample` data as described in {prerequisites}[Prerequisites].
The path to the required keyspace is specified by the query, so you do not need to set the query context.

Create a Composite Vector index that indexes the vector field named `colorvect_l2`, as well as the scalar `color` and `brightness` fields.
Expand All @@ -736,7 +736,7 @@ include::vector-index:example$gsi-vector-idx-examples.sqlpp[tag=create-rgb-idx]
[[ex-create-vectors-idx]]
.Create a Composite Vector index using embedded vectors
====
For this example, you must install the vector sample data as described in {prerequisites}[Prerequisites].
For this example, you must install the `color-vector-sample` data as described in {prerequisites}[Prerequisites].
The path to the required keyspace is specified by the query, so you do not need to set the query context.

Create a Composite Vector index that indexes the vector field named `embedding-vector-dot`, as well as the scalar `color` and `brightness` fields.
Expand All @@ -750,7 +750,7 @@ include::vector-index:example$gsi-vector-idx-examples.sqlpp[tag=create-vectors-i
[[ex-create-colors-idx]]
.Create a Composite Vector index with a scalar leading key
====
For this example, you must install the vector sample data as described in {prerequisites}[Prerequisites].
For this example, you must install the `color-vector-sample` data as described in {prerequisites}[Prerequisites].
The path to the required keyspace is specified by the query, so you do not need to set the query context.

Create a Composite Vector index that indexes the scalar `color` and `brightness` fields, as well as the vector field named `embedding-vector-dot`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ include::createindex.adoc[tags=defer-index-builds-by-default]

== Examples

To try the examples in this section, you must install the vector sample data as described in {prerequisites}[Prerequisites].
To try the examples in this section, you must install the `color-vector-sample` data as described in {prerequisites}[Prerequisites].

[[ex-create-rgb-idx]]
.Create a Hyperscale Vector index
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ include::dropindex.adoc[tags=usage]

== Examples

To try the examples in this section, you must install the vector sample data as described in {prerequisites}[Prerequisites].
To try the examples in this section, you must install the `color-vector-sample` data as described in {prerequisites}[Prerequisites].

[[ex-1]]
.Drop a Hyperscale Vector index
Expand All @@ -62,15 +62,15 @@ Drop the Hyperscale Vector index called `color_desc_hyperscale`, if it exists.
----
DROP VECTOR INDEX `color_desc_hyperscale`
IF EXISTS
ON `vector-sample`.color.rgb
ON `color-vector-sample`.color.rgb
----

The following command would drop the index in exactly the same way, but uses alternative syntax.

[source,sqlpp]
----
DROP VECTOR INDEX IF EXISTS
default:`vector-sample`.color.rgb.`color_desc_hyperscale`
default:`color-vector-sample`.color.rgb.`color_desc_hyperscale`
----
====

Expand Down
2 changes: 1 addition & 1 deletion modules/n1ql/pages/n1ql-language-reference/vectorfun.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,7 @@ Check whether the specified fields in the `rgb` collection contain vector values
SELECT ISVECTOR(description, 1, "float32") AS description,
ISVECTOR(colorvect_l2, 3, "float32") AS colorvect_l2,
ISVECTOR(embedding_vector_dot, 1536, "float32") AS embedding_vector_dot
FROM `vector-sample`.color.rgb LIMIT 1;
FROM `color-vector-sample`.color.rgb LIMIT 1;
----

.Results
Expand Down
8 changes: 4 additions & 4 deletions modules/vector-index/examples/find-reranking-cases.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@
COUCHBASE_URL = "couchbase://localhost"
USERNAME = "Administrator"
PASSWORD = "password"
BUCKET_NAME = "vector-sample"
BUCKET_NAME = "color-vector-sample"

# --- Connect to Cluster ---
cluster = Cluster(COUCHBASE_URL, ClusterOptions(PasswordAuthenticator(USERNAME, PASSWORD)))
cluster.wait_until_ready(timedelta(seconds=10))

# --- Get all search-color IDs ---
get_ids_query = "SELECT META().id AS id FROM `vector-sample`.`color`.`rgb`"
get_ids_query = "SELECT META().id AS id FROM `color-vector-sample`.`color`.`rgb`"
search_colors = cluster.query(get_ids_query)
search_color_ids = [row["id"] for row in search_colors]

Expand All @@ -29,10 +29,10 @@ def run_vector_query(search_color_id, use_rerank=False, limit=10):
query = f"""
WITH question_vec AS (
SELECT RAW couchbase_search_query.knn[0].vector
FROM `vector-sample`.`color`.`rgb-questions`
FROM `color-vector-sample`.`color`.`rgb-questions`
WHERE meta().id = "{search_color_id}")
SELECT b.color, b.description, b.id
FROM `vector-sample`.`color`.`rgb` AS b
FROM `color-vector-sample`.`color`.`rgb` AS b
ORDER BY APPROX_VECTOR_DISTANCE(b.embedding_vector_dot, question_vec[0], "l2", 4, {rerank_str})
LIMIT {limit};
"""
Expand Down
20 changes: 10 additions & 10 deletions modules/vector-index/examples/gsi-vector-idx-examples.sqlpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
SELECT RAW OBJECT_PUT(d, "embedding_vector_dot",
ARRAY_CONCAT(d.embedding_vector_dot[0:4], ["..."])
)
FROM `vector-sample`.`color`.`rgb` AS d
USE KEYS ["#FFEFD5"];
FROM `color-vector-sample`.`color`.`rgb` AS d
USE KEYS ["FFEFD5"];
/* end::get-sample-doc[] */

/* tag::get-sample-doc-question[] */
Expand All @@ -15,25 +15,25 @@ SELECT RAW OBJECT_PUT(d, "couchbase_search_query",
FOR k IN d.couchbase_search_query.knn END
)
)
FROM `vector-sample`.`color`.`rgb-questions` AS d
FROM `color-vector-sample`.`color`.`rgb-questions` AS d
USE KEYS ["#FFEFD5"];
/* end::get-sample-doc-question[] */


/* tag::create-rgb-idx[] */
CREATE INDEX `color_vectors_idx` ON `vector-sample`.`color`.`rgb`
CREATE INDEX `color_vectors_idx` ON `color-vector-sample`.`color`.`rgb`
(`colorvect_l2` VECTOR, color, brightness)
WITH { "dimension":3 , "similarity":"L2", "description":"IVF,SQ8"};
/* end::create-rgb-idx[] */

/* tag::create-vectors-idx[] */
CREATE INDEX `color_desc_idx` ON `vector-sample`.`color`.`rgb`
CREATE INDEX `color_desc_idx` ON `color-vector-sample`.`color`.`rgb`
(`embedding_vector_dot` VECTOR, color, brightness)
WITH { "dimension":1536, "similarity":"DOT", "description":" IVF,SQ8" }
/* end::create-vectors-idx[] */

/* tag::create-colors-idx[] */
CREATE INDEX `color_name_idx` ON `vector-sample`.`color`.`rgb`
CREATE INDEX `color_name_idx` ON `color-vector-sample`.`color`.`rgb`
(color, brightness, `embedding_vector_dot` VECTOR)
WITH { "dimension":1536, "similarity":"DOT", "description":" IVF,SQ8" }
/* end::create-colors-idx[] */
Expand All @@ -54,8 +54,8 @@ LIMIT 5;
/* tag::query-vectors-idx-subquery[] */
WITH question_vec AS (
SELECT RAW couchbase_search_query.knn[0].vector
from `vector-sample`.`color`.`rgb-questions`
WHERE meta().id = "#FFEFD5")
from `color-vector-sample`.`color`.`rgb-questions`
USE KEYS "#FFEFD5")
SELECT b.color, b.description from `rgb` AS b
order by APPROX_VECTOR_DISTANCE(b.embedding_vector_dot,
question_vec[0], "DOT") LIMIT 3;
Expand All @@ -64,8 +64,8 @@ question_vec[0], "DOT") LIMIT 3;
/* tag::query-vectors-idx-subquery-filtered[] */
WITH question_vec AS (
SELECT RAW couchbase_search_query.knn[0].vector
from `vector-sample`.`color`.`rgb-questions`
WHERE meta().id = "#FFEFD5")
from `color-vector-sample`.`color`.`rgb-questions`
USE KEYS "#FFEFD5")
SELECT b.color, b.description, b.brightness from `rgb` AS b
WHERE b.brightness > 190.0
order by APPROX_VECTOR_DISTANCE(b.embedding_vector_dot,
Expand Down
Loading