-
Notifications
You must be signed in to change notification settings - Fork 10
DOCSP-41144: Atlas Search Indexes #16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
mcmorisi
merged 4 commits into
mongodb:master
from
mcmorisi:DOCSP-41144-atlas-search-index
Jul 25, 2024
Merged
Changes from 1 commit
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,127 @@ | ||
.. _kotlin-sync-atlas-search-index: | ||
|
||
==================== | ||
Atlas Search Indexes | ||
==================== | ||
|
||
.. contents:: On this page | ||
:local: | ||
:backlinks: none | ||
:depth: 1 | ||
:class: singlecol | ||
|
||
.. facet:: | ||
:name: genre | ||
:values: reference | ||
|
||
.. meta:: | ||
:keywords: index, query, optimization, efficiency | ||
|
||
Overview | ||
-------- | ||
|
||
The Atlas Search feature enables you to perform full-text searches on | ||
mcmorisi marked this conversation as resolved.
Show resolved
Hide resolved
|
||
collections hosted on MongoDB Atlas. The indexes specify the behavior of | ||
mcmorisi marked this conversation as resolved.
Show resolved
Hide resolved
|
||
the search and which fields to index. | ||
|
||
You can call the following methods on a collection to manage your Atlas Search | ||
indexes: | ||
|
||
- ``createSearchIndex()`` | ||
- ``createSearchIndexes()`` | ||
- ``listSearchIndexes()`` | ||
- ``updateSearchIndex()`` | ||
- ``dropSearchIndex()`` | ||
|
||
.. note:: | ||
|
||
The Atlas Search Index management methods run asynchronously. The | ||
mcmorisi marked this conversation as resolved.
Show resolved
Hide resolved
|
||
driver methods can return before confirming that they ran | ||
successfully. To determine the current status of the indexes, call the | ||
mcmorisi marked this conversation as resolved.
Show resolved
Hide resolved
|
||
``listSearchIndexes()`` method. | ||
|
||
The following sections provide code examples that demonstrate how to use | ||
each of the preceding methods. | ||
|
||
.. _kotlin-sync-atlas-search-index-create: | ||
|
||
Create a Search Index | ||
--------------------- | ||
|
||
You can use the `createSearchIndex() <{+api+}/mongodb-driver-kotlin-sync/com.mongodb.kotlin.client/-mongo-collection/create-search-index.html>`__ | ||
and the `createSearchIndexes() <{+api+}/mongodb-driver-kotlin-sync/com.mongodb.kotlin.client/-mongo-collection/create-search-indexes.html>`__ | ||
methods to create Atlas Search indexes. | ||
mcmorisi marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
The following code example shows how to create a single index: | ||
|
||
.. literalinclude:: /includes/indexes/indexes.kt | ||
:language: kotlin | ||
:start-after: start-create-search-index | ||
:end-before: end-create-search-index | ||
:dedent: | ||
|
||
The following code example shows how to create multiple indexes: | ||
|
||
.. literalinclude:: /includes/indexes/indexes.kt | ||
:language: kotlin | ||
:start-after: start-create-search-indexes | ||
:end-before: end-create-search-indexes | ||
:dedent: | ||
|
||
.. _kotlin-sync-atlas-search-index-list: | ||
|
||
List Search Indexes | ||
------------------- | ||
|
||
You can use the | ||
`listSearchIndexes() <{+api+}/mongodb-driver-kotlin-sync/com.mongodb.kotlin.client/-mongo-collection/list-search-indexes.html>`__ | ||
method to return the Atlas Search indexes of a collection. | ||
mcmorisi marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
The following code example shows how to print a list of the search indexes of | ||
a collection: | ||
|
||
.. literalinclude:: /includes/indexes/indexes.kt | ||
:language: kotlin | ||
:start-after: start-list-search-indexes | ||
:end-before: end-list-search-indexes | ||
:dedent: | ||
|
||
.. _kotlin-sync-atlas-search-index-update: | ||
|
||
Update a Search Index | ||
--------------------- | ||
|
||
You can use the | ||
`updateSearchIndex() <{+api+}/mongodb-driver-kotlin-sync/com.mongodb.kotlin.client/-mongo-collection/update-search-index.html>`__ | ||
method to update an Atlas Search index. | ||
|
||
The following code shows how to update a search index: | ||
|
||
.. literalinclude:: /includes/indexes/indexes.kt | ||
:language: kotlin | ||
:start-after: start-update-search-indexes | ||
:end-before: end-update-search-indexes | ||
:dedent: | ||
|
||
.. _kotlin-sync-atlas-search-index-drop: | ||
|
||
Delete a Search Index | ||
--------------------- | ||
|
||
You can use the | ||
`dropSearchIndex() <{+api+}/mongodb-driver-kotlin-sync/com.mongodb.kotlin.client/-mongo-collection/drop-search-index.html>`__ | ||
method to delete an Atlas Search index. | ||
|
||
The following code shows how to delete a search index from a collection: | ||
|
||
.. literalinclude:: /includes/indexes/indexes.kt | ||
:language: kotlin | ||
:start-after: start-drop-search-index | ||
:end-before: end-drop-search-index | ||
:dedent: | ||
|
||
Additional Information | ||
---------------------- | ||
|
||
To learn more about MongoDB Atlas Search, see the :atlas:`Atlas Search Indexes </atlas-search/atlas-search-overview/>` | ||
documentation. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.