1
1
.. _pymongo-atlas-search-index:
2
2
3
- ====================
4
- Atlas Search Indexes
5
- ====================
3
+ ======================================
4
+ Atlas Search and Vector Search Indexes
5
+ ======================================
6
6
7
7
.. contents:: On this page
8
8
:local:
@@ -20,16 +20,23 @@ Atlas Search Indexes
20
20
Overview
21
21
--------
22
22
23
- The Atlas Search feature enables you to perform full-text searches on
24
- collections hosted on MongoDB Atlas. The indexes specify the behavior of
23
+ You can manage your :atlas:`Atlas Search </atlas-search>` and
24
+ :atlas:`Atlas Vector Search </atlas-vector-search/vector-search-overview/>`
25
+ indexes by using {+driver-short+}. The indexes specify the behavior of
25
26
the search and which fields to index.
26
27
27
- To learn more about MongoDB Atlas Search, see the
28
- :atlas:`Atlas Search Indexes </atlas-search/atlas-search-overview/>`
29
- documentation.
28
+ Atlas Search enables you to perform full-text searches on
29
+ collections hosted on MongoDB Atlas. Atlas Search indexes specify the behavior of
30
+ the search and which fields to index.
31
+
32
+ Atlas Vector Search enables you to perform semantic searches on vector
33
+ embeddings stored in MongoDB Atlas. Vector Search indexes define the
34
+ indexes for the vector embeddings that you want to query and the boolean,
35
+ date, objectId, numeric, string, or UUID values that you want to use to
36
+ pre-filter your data.
30
37
31
38
You can call the following methods on a collection to manage your Atlas Search
32
- indexes:
39
+ and Vector Search indexes:
33
40
34
41
- ``create_search_index()``
35
42
- ``create_search_indexes()``
@@ -55,16 +62,31 @@ Create a Search Index
55
62
You can use the `create_search_index() <{+api-root+}pymongo/collection.html#pymongo.collection.Collection.create_search_index>`__
56
63
and the
57
64
`create_search_indexes() <{+api-root+}pymongo/collection.html#pymongo.collection.Collection.create_search_indexes>`__
58
- methods to create Atlas Search indexes.
65
+ methods to create Atlas Search indexes or Atlas Vector Search indexes .
59
66
60
- The following code example shows how to create a single index:
67
+ The following code example shows how to create a single Atlas Search index:
61
68
62
69
.. literalinclude:: /includes/indexes/indexes.py
63
70
:language: python
64
71
:start-after: start-create-search-index
65
72
:end-before: end-create-search-index
66
73
67
- The following code example shows how to create multiple indexes:
74
+ The following code example shows how to create a single Atlas Vector Search index
75
+ by using the `SearchIndexModel <{+api-root+}pymongo/operations.html#pymongo.operations.SearchIndexModel>`__
76
+ object:
77
+
78
+ .. literalinclude:: /includes/indexes/indexes.py
79
+ :language: python
80
+ :start-after: start-create-vector-search-index
81
+ :end-before: end-create-vector-search-index
82
+
83
+ You can use the `create_search_indexes() <{+api-root+}pymongo/collection.html#pymongo.collection.Collection.create_search_indexes>`__
84
+ method to create multiple indexes. These indexes can be Atlas Search or
85
+ Vector Search indexes. The ``create_search_indexes()`` method takes a list of
86
+ ``SearchIndexModel`` objects that correspond to each index you want to create.
87
+
88
+ The following code example shows how to create an Atlas Search index and an Atlas
89
+ Vector Search index:
68
90
69
91
.. literalinclude:: /includes/indexes/indexes.py
70
92
:language: python
@@ -78,7 +100,8 @@ List Search Indexes
78
100
79
101
You can use the
80
102
`list_search_indexes() <{+api-root+}pymongo/collection.html#pymongo.collection.Collection.list_search_indexes>`__
81
- method to return the Atlas Search indexes of a collection.
103
+ method to get information about the Atlas Search and Vector Search indexes
104
+ of a collection.
82
105
83
106
The following code example shows how to print a list of the search indexes of
84
107
a collection:
@@ -96,24 +119,32 @@ Update a Search Index
96
119
97
120
You can use the
98
121
`update_search_index() <{+api-root+}pymongo/collection.html#pymongo.collection.Collection.update_search_index>`__
99
- method to update an Atlas Search index.
122
+ method to update an Atlas Search or Vector Search index.
100
123
101
- The following code shows how to update a search index:
124
+ The following code example shows how to update an Atlas Search index:
102
125
103
126
.. literalinclude:: /includes/indexes/indexes.py
104
127
:language: python
105
128
:dedent:
106
129
:start-after: start-update-search-indexes
107
130
:end-before: end-update-search-indexes
108
131
132
+ The following code example shows how to update an Atlas Vector Search index:
133
+
134
+ .. literalinclude:: /includes/indexes/indexes.py
135
+ :language: python
136
+ :dedent:
137
+ :start-after: start-update-vector-search-indexes
138
+ :end-before: end-update-vector-search-indexes
139
+
109
140
.. _pymongo-atlas-search-index-drop:
110
141
111
142
Delete a Search Index
112
143
---------------------
113
144
114
145
You can use the
115
146
`drop_search_index() <{+api-root+}pymongo/collection.html#pymongo.collection.Collection.drop_search_index>`__
116
- method to remove an Atlas Search index.
147
+ method to remove an Atlas Search or Vector Search index.
117
148
118
149
The following code shows how to delete a search index from a collection:
119
150
0 commit comments