diff --git a/source/atlas-search.txt b/source/atlas-search.txt index b0241ac2b..bef911d49 100644 --- a/source/atlas-search.txt +++ b/source/atlas-search.txt @@ -1,8 +1,8 @@ .. _node-atlas-search: -============ -Atlas Search -============ +========================= +Run an Atlas Search Query +========================= .. facet:: :name: genre diff --git a/source/atlas-vector-search.txt b/source/atlas-vector-search.txt index 1c5bd2c44..1d3ede7d9 100644 --- a/source/atlas-vector-search.txt +++ b/source/atlas-vector-search.txt @@ -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 -` section in the -Atlas documentation. To learn more about vector embeddings, see +vector search index, see the :ref:`` section in the +Indexes guide. To learn more about vector embeddings, see :atlas:`How to Create Vector Embeddings ` in the Atlas documentation. diff --git a/source/code-snippets/indexes/searchIndexes.js b/source/code-snippets/indexes/searchIndexes.js index d0ac72398..8eeff5770 100644 --- a/source/code-snippets/indexes/searchIndexes.js +++ b/source/code-snippets/indexes/searchIndexes.js @@ -17,7 +17,7 @@ async function run() { const collection = database.collection(""); // start createSearchIndex example - // Create a search index + // Creates an Atlas Search index const index1 = { name: "search1", definition: { @@ -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", @@ -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) { @@ -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, @@ -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 { diff --git a/source/indexes.txt b/source/indexes.txt index 49e4a103f..8d9d7837e 100644 --- a/source/indexes.txt +++ b/source/indexes.txt @@ -1,9 +1,9 @@ .. _node-fundamentals-indexes: .. _node-indexes: -======= -Indexes -======= +====================== +Indexes on Collections +====================== .. facet:: :name: genre @@ -339,27 +339,27 @@ To learn more, see :manual:`Unique Indexes `. .. _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 ` -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 +` 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 +` 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 ~~~~~~~~~~~~~~~~~~~~~ @@ -367,10 +367,10 @@ 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 @@ -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 -`. +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 @@ -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 @@ -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 @@ -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