Skip to content

Commit 6345613

Browse files
committed
DOC-12434: DDL for GSI Indexes with a Vector field (#275)
* Add vector index syntax to EBNF * Update script to use Railroad Diagram Generator 2.1 * Update syntax diagrams * Update primary index functionality * Update nav * Update indexing overview * Update index types * Add ALTER VECTOR INDEX * Add CREATE VECTOR INDEX * Add DROP VECTOR INDEX * Update ALTER INDEX * Update BUILD INDEX * Update CREATE INDEX * Update CREATE PRIMARY INDEX * Update DROP INDEX * UPDATE DROP PRIMARY INDEX * Update toc depth * Adjusting related links * Add composite vector index example * Add examples to ALTER VECTOR INDEX * Add clarification about base64 decoding * Update CREATE INDEX examples * DOC-12940: GSI Vector Index not supported on Windows (#406)
1 parent 0d992dd commit 6345613

35 files changed

+1124
-143
lines changed

diagrams.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
[[ -d ./build ]] || mkdir ./build
44

55
# install-rr
6-
[[ -f ./build/rr-2.0-java11.zip ]] || curl -L -o ./build/rr-2.0-java11.zip https://github.com/GuntherRademacher/rr/releases/download/v2.0/rr-2.0-java11.zip
6+
[[ -f ./build/rr-2.1-java11.zip ]] || curl -L -o ./build/rr-2.1-java11.zip https://github.com/GuntherRademacher/rr/releases/download/v2.1/rr-2.1-java11.zip
77

88
# extract-rr
9-
[[ -f ./build/rr/rr.war ]] || unzip ./build/rr-2.0-java11.zip -d ./build/rr
9+
[[ -f ./build/rr/rr.war ]] || unzip ./build/rr-2.1-java11.zip -d ./build/rr
1010

1111
for file in n1ql dcl ddl dml dql tcl hints utility
1212
do

modules/indexes/pages/index-replication.adoc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ This ensures:
4040
* _Availability_: If one Index-Service node is lost, the other continues to provide access to replicated indexes.
4141
* _High Performance_: If original and replica copies are available, incoming queries are load-balanced across them.
4242
43-
Index-replicas can be created with the {sqlpp} `CREATE INDEX` statement.
43+
Index-replicas can be created with the {sqlpp} `CREATE INDEX` or `CREATE VECTOR INDEX` statement.
4444
Note that whenever a given number of index-replicas is specified for creation, the number must be less than the number of cluster-nodes currently running the {index-service}[Index Service].
4545
If it is not, the index creation fails.
4646
Note also that if, following creation of the maximum number of copies, the number of nodes running the Index Service decreases, Couchbase Server progressively assigns replacement index-replicas to any and all Index-Service nodes subsequently be added to the cluster, until the required number of index-replicas again exists for each replicated index.
@@ -69,10 +69,10 @@ include::example$replication-num.n1ql[]
6969
+
7070
Note that if `nodes` and `num_replica` are both specified in the `WITH` clause, the specified number of nodes must be _one greater_ than `num_replica`.
7171
72-
* Specifying a number of index-replicas to be created by the Index Service whenever `CREATE INDEX` is invoked.
72+
* Specifying a number of index-replicas to be created by the Index Service whenever `CREATE INDEX` or `CREATE VECTOR INDEX` is invoked.
7373
The default is `0`.
7474
If the default is changed to, say, `2`, creation of a single index is henceforth accompanied by the creation of two replicas, which are automatically distributed across the nodes of the cluster running the Index Service.
75-
No explicit specification within the `CREATE INDEX` statement is required.
75+
No explicit specification within the `CREATE INDEX` or `CREATE VECTOR INDEX` statement is required.
7676
+
7777
With credentials that provide appropriate authorization, this default can be changed by means of the `curl` command, as follows:
7878
+
@@ -83,10 +83,10 @@ curl -X POST -u 'Administrator:password' \
8383
-d 'numReplica=2'
8484
----
8585
+
86-
Here, `numReplica` is an integer that establishes the default number of replicas that must be created whenever `CREATE INDEX` is invoked.
86+
Here, `numReplica` is an integer that establishes the default number of replicas that must be created whenever `CREATE INDEX` or `CREATE VECTOR INDEX` is invoked.
8787
Note that this call only succeeds if the cluster contains enough Index Service nodes to host each new index and its replicas: for example, if `2` is specified as the default number of replicas, the Index Service must have been established on at least 3 nodes.
8888
+
89-
Note also that whenever explicit specification of replica-numbers is made within the `CREATE INDEX` statement, this explicit specification takes precedence over any established default.
89+
Note also that whenever explicit specification of replica-numbers is made within the `CREATE INDEX` or `CREATE VECTOR INDEX` statement, this explicit specification takes precedence over any established default.
9090
9191
You can change index replication settings via the {index-storage-mode}[UI] or the {index-settings-via-rest}[REST API].
9292
For further information on using {sqlpp}, refer to {query}[Query Fundamentals].

modules/indexes/pages/indexing-and-query-perf.adoc

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
:bucket-analyzer: xref:tools:query-workbench.adoc#bucket-analyzer
1313
:storage-modes: xref:indexes:storage-modes.adoc
1414
:additional-storage-use: xref:learn:data/transactions.adoc#additional-storage-use
15+
:hyperscale-vector-index: xref:vector-index:hyperscale-vector-index.adoc
16+
:composite-vector-index: xref:vector-index:composite-vector-index.adoc
1517

1618
Creating the right index -- with the right keys, in the right order, and using the right expressions -- is critical to query performance in any database system.
1719
This is true for Couchbase as well.
@@ -20,7 +22,7 @@ This is true for Couchbase as well.
2022
.Examples on this Page
2123
****
2224
The examples in this topic use the travel-sample dataset which is shipped with Couchbase Server.
23-
For instructions on how to install the sample bucket, see {install-sample-buckets}[Sample Buckets].
25+
For instructions on how to install the sample bucket, see {install-sample-buckets}[].
2426
2527
include::ROOT:partial$query-context.adoc[tag=statement]
2628
****
@@ -79,7 +81,7 @@ Use the primary index for full keyspace scans (primary scans) when the query doe
7981

8082
NOTE: A primary index does not index any {additional-storage-use}[transaction records] that may be stored in a keyspace.
8183
This means that if you are counting the number of documents in a keyspace, you may see slightly different results, depending on whether you are using a primary index or not.
82-
Refer to {aggregatefun}[Aggregate Functions] and {bucket-analyzer}[Viewing the Data Insights].
84+
See {aggregatefun}[] and {bucket-analyzer}[Viewing the Data Insights].
8385

8486
.Metadata for Primary Index
8587
====
@@ -479,7 +481,7 @@ CREATE INDEX travel_sched ON route
479481
----
480482
====
481483

482-
For further details and examples, refer to {indexing-arrays}[Array Indexing].
484+
For further details and examples, see {indexing-arrays}[].
483485

484486
[#partial-index]
485487
== Partial Index
@@ -581,4 +583,21 @@ After the index selection is made, the query engine analyzes the query to see if
581583
If it does, the query engine skips retrieving the whole document from the data nodes.
582584
This is a performance optimization to keep in mind when designing your indexes.
583585

584-
For further details and examples, refer to {covering-indexes}[Covering Indexes].
586+
For further details and examples, see {covering-indexes}[].
587+
588+
[#hyperscale-vector-index]
589+
== Hyperscale Vector Index
590+
591+
Hyperscale vector indexes are a type of <<secondary-index>> which contain a single vector field.
592+
They excel at indexing huge datasets that can scale into the billions of documents.
593+
They're optimized for pure vector searches, offering the highest performance of any index for your AI applications.
594+
595+
For further details and examples, see {hyperscale-vector-index}[].
596+
597+
[#composite-vector-index]
598+
== Composite Vector Index
599+
600+
Composite vector indexes are a type of <<composite-secondary-index>> which contain a single vector field and one or more scalar fields.
601+
Your AI applications can use the index's scalar fields to filter the dataset before performing a vector similarity search.
602+
603+
For further details and examples, see {composite-vector-index}[].

modules/indexes/pages/indexing-overview.adoc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,13 @@ endif::[]
3535
* xref:n1ql:n1ql-language-reference/advise.adoc[ADVISE]
3636
* xref:n1ql:n1ql-language-reference/createindex.adoc[CREATE INDEX]
3737
* xref:n1ql:n1ql-language-reference/createprimaryindex.adoc[CREATE PRIMARY INDEX]
38+
* xref:n1ql:n1ql-language-reference/createvectorindex.adoc[CREATE VECTOR INDEX]
3839
* xref:n1ql:n1ql-language-reference/build-index.adoc[BUILD INDEX]
3940
* xref:n1ql:n1ql-language-reference/alterindex.adoc[ALTER INDEX]
41+
* xref:n1ql:n1ql-language-reference/altervectorindex.adoc[ALTER VECTOR INDEX]
4042
* xref:n1ql:n1ql-language-reference/dropindex.adoc[DROP INDEX]
4143
* xref:n1ql:n1ql-language-reference/dropprimaryindex.adoc[DROP PRIMARY INDEX]
44+
* xref:n1ql:n1ql-language-reference/dropvectorindex.adoc[DROP VECTOR INDEX]
4245

4346
== Storage and Availability
4447

@@ -52,3 +55,4 @@ endif::[]
5255
* xref:learn:services-and-indexes/services/index-service.adoc[Index Service Architecture]
5356
* xref:manage:manage-indexes/manage-indexes.adoc[Manage Indexes]
5457
* xref:manage:monitor/monitoring-indexes.adoc[Monitor Indexes]
58+
* xref:vector-index:vectors-and-indexes-overview.adoc[]
14.9 KB
Loading
2.32 KB
Loading
5.43 KB
Loading
2.6 KB
Loading
27.7 KB
Loading
-8.99 KB
Loading

0 commit comments

Comments
 (0)