@@ -202,9 +202,44 @@ Advanced Index Configuration
202
202
This section shows how to create the following advanced
203
203
index types:
204
204
205
+ - :ref:`django-indexes-atlas-search`
205
206
- :ref:`django-indexes-partial`
206
207
- :ref:`django-indexes-unique`
207
208
209
+ .. _django-indexes-atlas-search:
210
+
211
+ Atlas Search Indexes
212
+ ~~~~~~~~~~~~~~~~~~~~
213
+
214
+ Atlas Search indexes specify the behavior of an Atlas Search, which is a
215
+ full-text search on collections hosted on MongoDB Atlas.
216
+
217
+ To create an Atlas Search index, assign the ``indexes`` option in your model's
218
+ ``Meta`` class to a ``SearchIndex`` object. Pass the following arguments to the
219
+ ``SearchIndex()`` constructor:
220
+
221
+ - ``fields``: The fields you want to index.
222
+ - ``name``: *(Optional)* The name of your Atlas Search index. If you do not
223
+ specify this argument, {+framework+} automatically generates an index name.
224
+
225
+ The following example updates the ``Recipe`` model's ``Meta`` class to create
226
+ an Atlas Search index named ``"title_search_idx"`` on the ``title`` field:
227
+
228
+ .. literalinclude:: /includes/model-data/indexes.py
229
+ :start-after: start-atlas-search
230
+ :end-before: end-atlas-search
231
+ :language: python
232
+ :copyable:
233
+ :emphasize-lines: 3-8
234
+
235
+ .. tip::
236
+
237
+ To learn more about Atlas Search queries and indexes, see the following resources:
238
+
239
+ - :atlas:`Atlas Search </atlas-search>` in the Atlas documentation.
240
+ - `SearchIndex <{+api+}ref/models/indexes/#searchindex>`__ class in the
241
+ {+django-odm+} API documentation.
242
+
208
243
.. _django-indexes-partial:
209
244
210
245
Partial Indexes
0 commit comments