Skip to content

Commit

Permalink
DOCSP-37442: show vector search idx creation (#883)
Browse files Browse the repository at this point in the history
* DOCSP-37442: show vs index creation

* update

* staging

* fixes

* MW PR fixes 1

(cherry picked from commit 4cf3cda)
  • Loading branch information
rustagir committed Mar 14, 2024
1 parent 241e796 commit 35692a6
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
18 changes: 18 additions & 0 deletions source/code-snippets/indexes/searchIndexes.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,24 @@ async function run() {
await collection.createSearchIndex(index1);
// end createSearchIndex example

// start vectorSearchIdx example
// Create a Vector Search index
const vectorSearchIdx = {
name: "vsidx1",
type: "vectorSearch",
definition: {
fields: [{
type: "vector",
numDimensions: 384,
path: "summary",
similarity: "dotProduct"
}]
}
}

await collection.createSearchIndex(vectorSearchIdx);
// end vectorSearchIdx example

// start listSearchIndexes example
// List search indexes
const result = await collection.listSearchIndexes().toArray();
Expand Down
16 changes: 16 additions & 0 deletions source/fundamentals/indexes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,22 @@ use the ``createSearchIndex()`` method to create an index called
:start-after: start createSearchIndex example
:end-before: end createSearchIndex example

When connecting to {+mdb-server+} v6.0.11 and later v6 versions, or
v7.0.2 and later v7 versions, you can use the driver to create an Atlas
Vector Search index on a collection. Learn more about this feature in
the :atlas:`Atlas Vector Search documentation
</atlas-vector-search/vector-search-overview/>`.

The following code shows how to use the ``createSearchIndex()`` method
to create a search index in which the ``type`` field is
``vectorSearch``:

.. literalinclude:: /code-snippets/indexes/searchIndexes.js
:language: javascript
:dedent:
:start-after: start vectorSearchIdx example
:end-before: end vectorSearchIdx example

List Search Indexes
~~~~~~~~~~~~~~~~~~~

Expand Down

0 comments on commit 35692a6

Please sign in to comment.