Skip to content

DOCSP-48608 Edit AVS and AS section on Indexes page #1065

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Apr 2, 2025
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
6 changes: 3 additions & 3 deletions source/atlas-search.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
.. _node-atlas-search:

============
Atlas Search
============
=========================
Run an Atlas Search Query
=========================

.. facet::
:name: genre
Expand Down
5 changes: 2 additions & 3 deletions source/atlas-vector-search.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,8 @@ Perform a Vector Search

To use this feature, you must create a vector search index and index your
vector embeddings. To learn about how to programmatically create a
vector search index, see the :atlas:`Create an Atlas Vector Search Index
</atlas-vector-search/vector-search-type/#create-an-atlas-vector-search-index>` section in the
Atlas documentation. To learn more about vector embeddings, see
vector search index, see the :ref:`<node-indexes-search>` section in the
Indexes guide. To learn more about vector embeddings, see
:atlas:`How to Create Vector Embeddings
</atlas-vector-search/create-embeddings/>` in the Atlas documentation.

Expand Down
10 changes: 5 additions & 5 deletions source/code-snippets/indexes/searchIndexes.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ async function run() {
const collection = database.collection("<collectionName>");

// start createSearchIndex example
// Create a search index
// Creates an Atlas Search index
const index1 = {
name: "search1",
definition: {
Expand All @@ -30,7 +30,7 @@ async function run() {
// end createSearchIndex example

// start vectorSearchIdx example
// Create a Vector Search index
// Creates an Atlas Vector Search index
const vectorSearchIdx = {
name: "vsidx1",
type: "vectorSearch",
Expand All @@ -48,7 +48,7 @@ async function run() {
// end vectorSearchIdx example

// start listSearchIndexes example
// List search indexes
// Lists search indexes
const result = await collection.listSearchIndexes().toArray();
console.log("Existing search indexes:\n");
for (const doc in result) {
Expand All @@ -57,7 +57,7 @@ async function run() {
// end listSearchIndexes example

// start updateSearchIndex example
// Update a search index
// Updates a search index
const index2 = {
"mappings": {
"dynamic": true,
Expand All @@ -72,7 +72,7 @@ async function run() {
// end updateSearchIndex example

// start dropSearchIndex example
// Dropping (deleting) a search index
// Drops (deletes) a search index
await collection.dropSearchIndex("search1");
// end dropSearchIndex example
} finally {
Expand Down
83 changes: 40 additions & 43 deletions source/indexes.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
.. _node-fundamentals-indexes:
.. _node-indexes:

=======
Indexes
=======
======================
Indexes on Collections
======================

.. facet::
:name: genre
Expand Down Expand Up @@ -339,38 +339,38 @@ To learn more, see :manual:`Unique Indexes </core/index-unique>`.

.. _node-indexes-search:

Search Indexes
--------------
Atlas Search and Atlas Vector Search Indexes
--------------------------------------------

Atlas Search is a feature that allows you to perform full-text
searches. To learn more, see the :ref:`Atlas Search <fts-top-ref>`
documentation.
You can programmatically manage your Atlas Search and Atlas Vector
Search indexes by using the {+driver-short+}.

Before you can perform a search on an Atlas collection, you must first
create an Atlas Search index on the collection. An Atlas Search
index is a data structure that categorizes data in a searchable format.
The Atlas Search feature enables you to perform full-text searches on
collections hosted on MongoDB Atlas. To learn more about Atlas
Search, see the :atlas:`Atlas Search
</atlas-search/atlas-search-overview/>` documentation.

You can use the following methods to manage your Search indexes:
Atlas Vector Search enables you to perform semantic searches on vector
embeddings stored in Atlas. To learn more about Atlas
Vector Search, see the :atlas:`Atlas Vector Search
</atlas-vector-search/vector-search-overview/>` documentation.

- ``createSearchIndex()``
- ``createSearchIndexes()``
- ``listSearchIndexes()``
- ``updateSearchIndex()``
- ``dropSearchIndex()``
To learn more about how to run an Atlas Search or Atlas Vector Search query, see the
:ref:`node-atlas-search` or :ref:`node-atlas-vector-search` guide.

The following sections provide code samples that use each of the preceding
methods to manage Search indexes.
The following sections contain code examples that demonstrate how to manage Atlas
Search and Atlas Vector Search indexes.

Create a Search Index
~~~~~~~~~~~~~~~~~~~~~

You can use the `createSearchIndex()
<{+api+}/classes/Collection.html#createSearchIndex>`__ and
`createSearchIndexes() <{+api+}/classes/Collection.html#createSearchIndexes>`__
methods to create new Search indexes.
methods to create new Atlas Search and Atlas Vector Search indexes.

The following code shows how to
use the ``createSearchIndex()`` method to create an index called
use the ``createSearchIndex()`` method to create an Atlas Search index called
``search1``:

.. literalinclude:: /code-snippets/indexes/searchIndexes.js
Expand All @@ -379,15 +379,12 @@ 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/>`.
When connecting to {+mdb-server+} v6.0.11 and later, you can use the driver to
create an Atlas Vector Search index by specifying ``vectorSearch`` in the ``type``
field of the index definition.

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

.. literalinclude:: /code-snippets/indexes/searchIndexes.js
:language: javascript
Expand All @@ -400,13 +397,14 @@ List Search Indexes

You can use the `listSearchIndexes()
<{+api+}/classes/Collection.html#listSearchIndexes>`__
method to return a cursor that contains the Search indexes of a given
collection. The ``listSearchIndexes()`` method takes an optional string
parameter, ``name``, to return only the indexes with matching names. It
also takes an optional `aggregateOptions <{+api+}/interfaces/AggregateOptions.html>`__ parameter.
method to return a cursor that contains the Atlas Search and Atlas Vector Search
indexes of a given collection. The ``listSearchIndexes()`` method takes an
optional string parameter, ``name``, to return only the indexes with matching
names. It also takes an optional
`aggregateOptions <{+api+}/interfaces/AggregateOptions.html>`__ parameter.

The following code uses the ``listSearchIndexes()`` method to list the
Search indexes in a collection:
Atlas Search and Atlas Vector Search indexes in a collection:

.. literalinclude:: /code-snippets/indexes/searchIndexes.js
:language: javascript
Expand All @@ -418,12 +416,12 @@ Update a Search Index
~~~~~~~~~~~~~~~~~~~~~

You can use the `updateSearchIndex()
<{+api+}/classes/Collection.html#updateSearchIndex>`__ method to update a Search
index.
<{+api+}/classes/Collection.html#updateSearchIndex>`__ method to update an
Atlas Search or Atlas Vector Search index by providing a new index definition.

The following code shows how to
use the ``updateSearchIndex()`` method to update an index called
``search1`` to specify a string type for the ``description`` field:
The following code shows how to use the ``updateSearchIndex()`` method to
update an Atlas Search index called ``search1`` to change the type of the
``description`` field to a string:

.. literalinclude:: /code-snippets/indexes/searchIndexes.js
:language: javascript
Expand All @@ -435,12 +433,11 @@ Drop a Search Index
~~~~~~~~~~~~~~~~~~~

You can use the `dropSearchIndex()
<{+api+}/classes/Collection.html#dropSearchIndex>`__ method to remove a Search
index.
<{+api+}/classes/Collection.html#dropSearchIndex>`__ method to remove an Atlas
Search or Atlas Vector Search index.

The following code shows how to
use the ``dropSearchIndex()`` method to remove an index called
``search1``:
The following code shows how to use the ``dropSearchIndex()`` method to remove
an index called ``search1``:

.. literalinclude:: /code-snippets/indexes/searchIndexes.js
:language: javascript
Expand Down
Loading