@@ -15,14 +15,21 @@ Atlas Search Indexes
1515 :values: reference
1616
1717.. meta::
18- :keywords: index, query, optimization, efficiency
18+ :keywords: index, query, optimization, efficiency, code example
1919
2020Overview
2121--------
2222
23- :atlas:`Atlas Search </atlas-search>` enables you to perform full-text searches on
24- collections hosted on MongoDB Atlas. With Atlas Search indexes, you can specify the
25- behavior of the search and which fields to index.
23+ In this guide, you can learn how to programmatically manage your Atlas
24+ Search and Atlas Vector Search indexes by using the {+driver-short+}.
25+
26+ The Atlas Search feature enables you to perform full-text searches on
27+ collections hosted on MongoDB Atlas. To learn more about Atlas Search,
28+ see the :atlas:`Atlas Search Overview </atlas-search/atlas-search-overview/>`.
29+
30+ Atlas Vector Search enables you to perform semantic searches on vector
31+ embeddings stored in MongoDB Atlas. To learn more about Atlas Vector Search,
32+ see the :atlas:`Atlas Vector Search Overview </atlas-vector-search/vector-search-overview/>`.
2633
2734You can call the following methods to manage you Atlas Search indexes:
2835
@@ -31,6 +38,14 @@ You can call the following methods to manage you Atlas Search indexes:
3138- ``search_indexes#update_one``
3239- ``search_indexes#drop_one``
3340
41+ .. note:: Atlas Search and Vector Search Index Management is Asynchronous
42+
43+ The {+driver-short+} manages Atlas Search and Vector Search indexes
44+ asynchronously. The methods described in the following
45+ sections return the server response immediately, but the changes to
46+ your Search indexes take place in the background and might not
47+ complete until some time later.
48+
3449The following sections provide code examples that demonstrate how to use
3550each of the preceding commands.
3651
@@ -39,29 +54,44 @@ each of the preceding commands.
3954Create a Search Index
4055---------------------
4156
42- To create one or more Atlas Search indexes, use the ``search_indexes#create_one``
43- or the ``search_indexes#create_many`` method. Both methods return immediately,
57+ To create a single Atlas Search or Vector Search index, use the
58+ ``search_indexes#create_one`` method. To create multiple indexes, use the
59+ ``search_indexes#create_many`` method. Both methods return immediately,
4460while the indexes are asynchronously created in the background.
4561
46- The following code example shows how to create an Atlas Search index by providing
47- an index definition and an optional name for the index:
62+ The following code example shows how to create an Atlas Search index by
63+ providing an index definition and an optional name for the index:
4864
4965.. literalinclude:: /includes/indexes/atlas-search-index.rb
5066 :language: ruby
5167 :start-after: start-create-search-index
5268 :end-before: end-create-search-index
5369 :emphasize-lines: 15
5470
55- You can use ``search_indexes#create_many`` to create multiple Atlas Search indexes by
56- providing an array of index specifications. Each index specification should include a definition
57- key, which defines the index, and a name key to specify the index name. The following
58- code example shows how to create multiple search indexes:
71+ .. note::
72+
73+ By default, the driver creates an Atlas Search index if you do not
74+ pass a ``type`` parameter. To create a Vector Search index, you must
75+ set the ``type`` parameter to ``'vectorSearch'`` when calling
76+ ``create_one``.
77+
78+ You can use ``search_indexes#create_many`` to create multiple Atlas
79+ Search or Vector Search indexes by providing an array of index
80+ specifications. Each index specification should include the following
81+ components:
82+
83+ - ``definition`` parameter: Defines the index
84+ - ``name`` parameter: Specifies the index name
85+ - ``type`` parameter: Specifies the type of index (``'search'`` or ``'vectorSearch'``)
86+
87+ The following code example shows how to create Atlas Search and Vector
88+ Search indexes in one call:
5989
6090.. literalinclude:: /includes/indexes/atlas-search-index.rb
6191 :language: ruby
6292 :start-after: start-create-multiple-search-indexes
6393 :end-before: end-create-multiple-search-indexes
64- :emphasize-lines: 25
94+ :emphasize-lines: 29
6595
6696For longer index definitions, it is helpful to define the index definitions outside
6797of the method call. To learn more about the syntax of index definitions, see the
@@ -71,11 +101,12 @@ guide in the Atlas manual.
71101Update a Search Index
72102---------------------
73103
74- To update an Atlas Search index, use the ``search_indexes#update_one`` method.
104+ To update an Atlas Search or Vector Search index, use the
105+ ``search_indexes#update_one`` method.
75106
76107To update an index, you must provide a new index definition. You must specify
77108the index you want to update by using either the ``name`` or ``id`` of the index.
78- The following code shows how to update a search index:
109+ The following code shows how to update an Atlas Search index:
79110
80111.. literalinclude:: /includes/indexes/atlas-search-index.rb
81112 :language: ruby
@@ -85,10 +116,12 @@ The following code shows how to update a search index:
85116Delete a Search Index
86117---------------------
87118
88- To delete an Atlas Search index, use the ``search_indexes#drop_one`` method.
119+ To delete an Atlas Search or Vector Search index, use the
120+ ``search_indexes#drop_one`` method.
89121
90- To delete an index, you must provide the ``id`` or ``name`` of the index. The following
91- code shows how to delete a search index from a collection:
122+ To delete an index, you must provide the ``id`` or ``name`` of the
123+ index. The following code shows how to delete a search index from a
124+ collection:
92125
93126.. literalinclude:: /includes/indexes/atlas-search-index.rb
94127 :language: ruby
@@ -98,8 +131,9 @@ code shows how to delete a search index from a collection:
98131List Search Indexes
99132-------------------
100133
101- You can use the ``search_indexes`` object to list the entire index specification
102- of each index:
134+ You can use the ``search_indexes`` object to list the entire index
135+ specification of each Atlas Search and Vector Search index on a
136+ collection:
103137
104138.. literalinclude:: /includes/indexes/atlas-search-index.rb
105139 :language: ruby
0 commit comments