File tree Expand file tree Collapse file tree 2 files changed +34
-0
lines changed Expand file tree Collapse file tree 2 files changed +34
-0
lines changed Original file line number Diff line number Diff line change @@ -29,6 +29,24 @@ async function run() {
29
29
await collection . createSearchIndex ( index1 ) ;
30
30
// end createSearchIndex example
31
31
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
+
32
50
// start listSearchIndexes example
33
51
// List search indexes
34
52
const result = await collection . listSearchIndexes ( ) . toArray ( ) ;
Original file line number Diff line number Diff line change @@ -378,6 +378,22 @@ use the ``createSearchIndex()`` method to create an index called
378
378
:start-after: start createSearchIndex example
379
379
:end-before: end createSearchIndex example
380
380
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
+
381
397
List Search Indexes
382
398
~~~~~~~~~~~~~~~~~~~
383
399
You can’t perform that action at this time.
0 commit comments