Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions source/fundamentals/atlas-search.txt
Original file line number Diff line number Diff line change
Expand Up @@ -88,18 +88,24 @@ Autocomplete
Use the ``Autocomplete()`` method to search for a word or phrase that contains a
sequence of characters from an incomplete input string.

The following example performs an autocomplete search on the ``guitars``
collection using the string "Gib" in the ``make`` field.
The following example performs an autocomplete query on the ``make``
field for text that starts with the string ``"Gib"``.

.. literalinclude:: /includes/fundamentals/code-examples/atlas-search/AtlasSearchExamples.cs
:start-after: // start-autocomplete-search
:end-before: // end-autocomplete-search
:language: csharp
:dedent:

.. note::
.. note:: Index for Autocomplete Queries

If the field you are searching on is indexed by a search index, you must pass the index name to the ``Autocomplete`` call. If a search index does not exist, the default index is used.
You must create an Atlas Search index that supports autocompletion
to successfully perform autocomplete queries. To learn more, see
:atlas:`How to Index Fields for Autocompletion </atlas-search/field-types/autocomplete-type/>`
in the Atlas documentation.

After you create the Atlas Search index, you must pass the index name to
the ``Autocomplete()`` method, as shown in the preceding code.

The search returns the following document:

Expand Down
Loading