@@ -20,26 +20,30 @@ Atlas Search Indexes
20
20
Overview
21
21
--------
22
22
23
- :atlas:`Atlas Search </atlas-search>` enables you to perform full-text searches on
24
- collections hosted on MongoDB Atlas. Atlas Search indexes specify the behavior of
25
- 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
+ in the Atlas documentation.
30
+
31
+ Atlas Vector Search enables you to perform semantic searches on vector
32
+ embeddings stored in MongoDB Atlas. To learn more about Atlas Vector Search,
33
+ see the :atlas:`Atlas Vector Search Overview </atlas-vector-search/vector-search-overview/>`
34
+ in the Atlas documentation.
26
35
27
36
The following sections provide code examples that demonstrate how to create, list, update,
28
- and delete Atlas Search indexes.
37
+ and delete Atlas Search and Vector Search indexes.
29
38
30
39
.. _c-atlas-search-index-create:
31
40
32
41
Create a Search Index
33
42
---------------------
34
43
35
- You can pass the ``createSearchIndexes`` command to the ``mongoc_collection_command_simple()``
36
- function to create one or more Atlas Search indexes.
37
-
38
- You can also use this function to create Atlas Vector Search indexes.
39
- Atlas Vector Search enables you to perform semantic searches on vector
40
- embeddings stored in MongoDB Atlas. To learn more about this feature,
41
- see the :atlas:`Atlas Vector Search Overview
42
- </atlas-vector-search/vector-search-overview/>` in the Atlas documentation.
44
+ To create an Atlas Search or Vector Search index, pass the ``createSearchIndexes``
45
+ command to the ``mongoc_collection_command_simple()`` function. You can use this command
46
+ to create one or multiple indexes.
43
47
44
48
The following code example shows how to create an Atlas Search index:
45
49
@@ -49,26 +53,37 @@ The following code example shows how to create an Atlas Search index:
49
53
:end-before: end-create-search-index
50
54
:dedent:
51
55
52
- The following code example shows how to create multiple indexes:
56
+ The following code example shows how to create an Atlas Vector Search index:
57
+
58
+ .. literalinclude:: /includes/indexes/indexes.c
59
+ :language: c
60
+ :start-after: start-create-vector-search-index
61
+ :end-before: end-create-vector-search-index
62
+ :dedent:
63
+
64
+ The following code example shows how to create both search indexes in
65
+ one call to the ``mongoc_collection_command_simple()`` function:
53
66
54
67
.. literalinclude:: /includes/indexes/indexes.c
55
68
:language: c
56
69
:start-after: start-create-search-indexes
57
70
:end-before: end-create-search-indexes
58
71
:dedent:
59
72
60
- To learn more about the syntax used to define Atlas Search indexes, see the
61
- :atlas:`Review Atlas Search Index Syntax </atlas-search/index-definitions>` guide
62
- in the Atlas documentation.
73
+ To learn more about the syntax used to define each search index, see the
74
+ following guides in the Atlas documentation:
75
+
76
+ - :atlas:`Review Atlas Search Index Syntax </atlas-search/index-definitions>`
77
+ - :atlas:`How to Index Fields for Vector Search </atlas-vector-search/vector-search-type/>`
63
78
64
79
.. _c-atlas-search-index-list:
65
80
66
81
List Search Indexes
67
82
-------------------
68
83
69
84
You can pass the ``$listSearchIndexes`` aggregation stage to the
70
- ``mongoc_collection_aggregate()`` function to return all Atlas Search indexes in a
71
- collection.
85
+ ``mongoc_collection_aggregate()`` function to return all Atlas Search
86
+ and Vector Search indexes in a collection.
72
87
73
88
The following code example shows how to print a list of the search indexes in
74
89
a collection:
@@ -85,23 +100,35 @@ Update a Search Index
85
100
---------------------
86
101
87
102
You can pass the ``updateSearchIndex`` command to the ``mongoc_collection_command_simple()``
88
- function to update an Atlas Search index.
103
+ function to update an Atlas Search or Vector Search index.
89
104
90
- The following code shows how to update a search index:
105
+ The following code shows how to update the Atlas Search index
106
+ created in the :ref:`c-atlas-search-index-create` section of this guide
107
+ to use dynamic mappings:
91
108
92
109
.. literalinclude:: /includes/indexes/indexes.c
93
110
:language: c
94
111
:start-after: start-update-search-index
95
112
:end-before: end-update-search-index
96
113
:dedent:
97
114
115
+ The following code shows how to update the Atlas Vector Search
116
+ index created in the :ref:`c-atlas-search-index-create` section of this guide
117
+ to use the ``cosine`` similarity function:
118
+
119
+ .. literalinclude:: /includes/indexes/indexes.c
120
+ :language: c
121
+ :start-after: start-update-vector-search-index
122
+ :end-before: end-update-vector-search-index
123
+ :dedent:
124
+
98
125
.. _c-atlas-search-index-drop:
99
126
100
127
Delete a Search Index
101
128
---------------------
102
129
103
130
You can pass the ``dropSearchIndexes`` command to the ``mongoc_collection_command_simple()``
104
- function to delete an Atlas Search index.
131
+ function to delete an Atlas Search or Vector Search index.
105
132
106
133
The following code shows how to delete a search index from a collection:
107
134
@@ -114,8 +141,11 @@ The following code shows how to delete a search index from a collection:
114
141
Additional Information
115
142
----------------------
116
143
117
- To learn more about MongoDB Atlas Search, see the :atlas:`Atlas Search Indexes </atlas-search/atlas-search-overview/>`
118
- documentation.
144
+ To learn more about MongoDB Atlas Search, see :atlas:`Atlas Search Indexes </atlas-search/atlas-search-overview/>`
145
+ in the Atlas documentation.
146
+
147
+ To learn more about MongoDB Atlas Vector Search, see :atlas:`How to Index Fields for Vector Search
148
+ </atlas-vector-search/vector-search-type/>` in the Atlas documentation.
119
149
120
150
API Documentation
121
151
~~~~~~~~~~~~~~~~~
0 commit comments