Skip to content

Commit 4cf3cda

Browse files
authored
DOCSP-37442: show vector search idx creation (#883)
* DOCSP-37442: show vs index creation * update * staging * fixes * MW PR fixes 1
1 parent 241e796 commit 4cf3cda

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed

source/code-snippets/indexes/searchIndexes.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,24 @@ async function run() {
2929
await collection.createSearchIndex(index1);
3030
// end createSearchIndex example
3131

32+
// start vectorSearchIdx example
33+
// Create a Vector Search index
34+
const vectorSearchIdx = {
35+
name: "vsidx1",
36+
type: "vectorSearch",
37+
definition: {
38+
fields: [{
39+
type: "vector",
40+
numDimensions: 384,
41+
path: "summary",
42+
similarity: "dotProduct"
43+
}]
44+
}
45+
}
46+
47+
await collection.createSearchIndex(vectorSearchIdx);
48+
// end vectorSearchIdx example
49+
3250
// start listSearchIndexes example
3351
// List search indexes
3452
const result = await collection.listSearchIndexes().toArray();

source/fundamentals/indexes.txt

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -378,6 +378,22 @@ use the ``createSearchIndex()`` method to create an index called
378378
:start-after: start createSearchIndex example
379379
:end-before: end createSearchIndex example
380380

381+
When connecting to {+mdb-server+} v6.0.11 and later v6 versions, or
382+
v7.0.2 and later v7 versions, you can use the driver to create an Atlas
383+
Vector Search index on a collection. Learn more about this feature in
384+
the :atlas:`Atlas Vector Search documentation
385+
</atlas-vector-search/vector-search-overview/>`.
386+
387+
The following code shows how to use the ``createSearchIndex()`` method
388+
to create a search index in which the ``type`` field is
389+
``vectorSearch``:
390+
391+
.. literalinclude:: /code-snippets/indexes/searchIndexes.js
392+
:language: javascript
393+
:dedent:
394+
:start-after: start vectorSearchIdx example
395+
:end-before: end vectorSearchIdx example
396+
381397
List Search Indexes
382398
~~~~~~~~~~~~~~~~~~~
383399

0 commit comments

Comments
 (0)