-
Notifications
You must be signed in to change notification settings - Fork 51
DOCSP-48385 Make Atlas Vector Search page #1042
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
Changes from 15 commits
de35100
16b076f
ad02335
d0861ae
eb3d638
352b609
5a9c66b
4c70a5a
7031ae8
c8547d5
bab15fc
7518048
0cb7f04
75c9ecb
b1481a4
d0d6e7d
ddff046
d0627a6
9489bdf
a592593
2a8876d
4533009
a593d9d
2598b4e
5738a01
3e491d9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,130 @@ | ||||||||
.. _node-atlas-vector-search: | ||||||||
|
||||||||
=================== | ||||||||
Atlas Vector Search | ||||||||
=================== | ||||||||
|
||||||||
.. facet:: | ||||||||
:name: genre | ||||||||
:values: reference | ||||||||
|
||||||||
.. meta:: | ||||||||
:keywords: code example, semantic, nearest | ||||||||
|
||||||||
.. contents:: On this page | ||||||||
:local: | ||||||||
:backlinks: none | ||||||||
:depth: 2 | ||||||||
:class: singlecol | ||||||||
|
||||||||
Overview | ||||||||
-------- | ||||||||
|
||||||||
In this guide, you can learn how to use the :atlas:`Atlas Vector Search | ||||||||
</atlas-vector-search/vector-search-overview/>` feature | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Remove the link here since there is a "learn more" at bottom of the section |
||||||||
in the {+driver-short+}. | ||||||||
|
||||||||
You can use {+vector-search+} to perform a vector search on your data stored in | ||||||||
Atlas. Vector search allows you to query your data based on semantic meaning | ||||||||
rather than just keyword matches, which helps you retrieve more relevant search | ||||||||
results. It enables your AI-powered applications to support use cases such as | ||||||||
semantic search, hybrid search, and generative search, including | ||||||||
Retrieval-Augmented Generation (RAG). | ||||||||
|
||||||||
To learn more about {+vector-search+}, see the :atlas:`{+vector-search+} | ||||||||
</atlas-vector-search/vector-search-overview/>` guide in the MongoDB Atlas | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||
documentation. | ||||||||
|
||||||||
.. important:: Feature Compatibility | ||||||||
|
||||||||
To learn what versions of MongoDB Atlas support this feature, see | ||||||||
:atlas:`Limitations </atlas-vector-search/vector-search-stage/#limitations>` | ||||||||
in the MongoDB Atlas documentation. | ||||||||
|
||||||||
Perform a Vector Search | ||||||||
----------------------- | ||||||||
|
||||||||
To use this feature, you must create a vector search index and index your | ||||||||
vector embeddings. To learn about how to programmatically create a | ||||||||
vector search index, see the :atlas:`Create an Atlas Vector Search index | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Capitalize title |
||||||||
</atlas-vector-search/vector-search-type/#create-an-atlas-vector-search-index>` section in the | ||||||||
Atlas documentation. To learn more about vector embeddings, see | ||||||||
:atlas:`How to Create Vector Embeddings | ||||||||
</atlas-vector-search/create-embeddings/>` in the Atlas documentation. | ||||||||
|
||||||||
After you create a vector search index on your vector embeddings, you | ||||||||
can reference this index in your pipeline stage, as shown in the | ||||||||
following section. | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Since Sample Data is now the next section |
||||||||
|
||||||||
Sample Data | ||||||||
----------- | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Should be a subheading |
||||||||
|
||||||||
The example on this page shows how to build an aggregation pipeline that uses the | ||||||||
``$vectorSearch`` stage to perform an exact vector search on the | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
The example is an ANN rather than an ENN search. Here's the documentation: https://www.mongodb.com/docs/atlas/atlas-vector-search/vector-search-stage/#fields |
||||||||
``sample_mflix.embedded_movies`` collection in the :atlas:`Atlas sample datasets | ||||||||
</sample-data>`. | ||||||||
|
||||||||
To learn how to create a free MongoDB Atlas cluster and load the sample datasets, see the | ||||||||
:atlas:`Get Started with Atlas </getting-started>` guide. | ||||||||
|
||||||||
Vector Search Example | ||||||||
~~~~~~~~~~~~~~~~~~~~~ | ||||||||
|
||||||||
You can perform a vector search query by using the ``$vectorSearch`` stage | ||||||||
in an :ref:`aggregation pipeline <node-aggregation>`. To perform a vector | ||||||||
search on a collection, you must first have a collection with a field that contains | ||||||||
vector embeddings and a vector search index that covers that field. | ||||||||
|
||||||||
The aggregation pipeline searches the ``plot`` field of each document in the collection | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||
for text semantically related to the term "time travel". The ``queryVector`` field in the | ||||||||
``$vectorSearch`` pipeline is the vector representation of your query. | ||||||||
|
||||||||
.. io-code-block:: | ||||||||
:copyable: true | ||||||||
|
||||||||
.. input:: /includes/aggregation/atlas-vector-search-example.js | ||||||||
:language: javascript | ||||||||
:dedent: | ||||||||
|
||||||||
.. output:: | ||||||||
:language: json | ||||||||
nbbeeken marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||
:visible: false | ||||||||
|
||||||||
'{"plot":"A reporter, learning of time travelers visiting 20th century disasters, tries to change the history they know by averting upcoming disasters.","title":"Thrill Seekers","score":0.7892671227455139}' | ||||||||
'{"plot":"At the age of 21, Tim discovers he can travel in time and change what happens and has happened in his own life. His decision to make his world a better place by getting a girlfriend turns out not to be as easy as you might think.","title":"About Time","score":0.7843604683876038}' | ||||||||
'{"plot":"Hoping to alter the events of the past, a 19th century inventor instead travels 800,000 years into the future, where he finds humankind divided into two warring races.","title":"The Time Machine","score":0.7801066637039185}' | ||||||||
`{"plot":"After using his mother's newly built time machine, Dolf gets stuck involuntary in the year 1212. He ends up in a children's crusade where he confronts his new friends with modern techniques...","title":"Crusade in Jeans","score":0.7789170742034912}` | ||||||||
'{"plot":"An officer for a security agency that regulates time travel, must fend for his life against a shady politician who has a tie to his past.","title":"Timecop","score":0.7771612405776978}' | ||||||||
'{"plot":"A time-travel experiment in which a robot probe is sent from the year 2073 to the year 1973 goes terribly wrong thrusting one of the project scientists, a man named Nicholas Sinclair into a...","title":"A.P.E.X.","score":0.7730885744094849}' | ||||||||
`{"plot":"Agent J travels in time to M.I.B.'s early days in 1969 to stop an alien from assassinating his friend Agent K and changing history.","title":"Men in Black 3","score":0.7712380886077881}` | ||||||||
'{"plot":"Bound by a shared destiny, a teen bursting with scientific curiosity and a former boy-genius inventor embark on a mission to unearth the secrets of a place somewhere in time and space that exists in their collective memory.","title":"Tomorrowland","score":0.7669923901557922}' | ||||||||
'{"plot":"With the help of his uncle, a man travels to the future to try and bring his girlfriend back to life.","title":"Love Story 2050","score":0.7649372816085815}' | ||||||||
'{"plot":"A dimension-traveling wizard gets stuck in the 21st century because cell-phone radiation interferes with his magic. With his home world on the brink of war, he seeks help from a jaded ...","title":"The Portal","score":0.7640786170959473}' | ||||||||
|
||||||||
This query uses the ``$vectorSearch`` stage to: | ||||||||
|
||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Include the type of search |
||||||||
- Search for the specified term in the ``plot_embedding`` field | ||||||||
|
||||||||
- Set the number of nearest neighbors used in the search to 150 by using the ``numCandidates`` option | ||||||||
|
||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
S: Add a description of what |
||||||||
It uses the ``$project`` stage to: | ||||||||
|
||||||||
- Only include the movie ``plot`` and ``title`` fields in the results. | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
S: Be consistent with period use. I would consider these fragments, so it doesn't need a period. |
||||||||
|
||||||||
- Add a ``score`` field to show the relevance of each result to the search term. | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Same as above |
||||||||
|
||||||||
Additional Information | ||||||||
---------------------- | ||||||||
|
||||||||
To find more tutorials on using the {+driver-short+} to perform Atlas | ||||||||
Vector Searches, see the :atlas:`Atlas Vector Search tutorials </atlas-vector-search/tutorials/>` | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
S: Reword and capitalize tutorials |
||||||||
in the Atlas documentation. | ||||||||
|
||||||||
To learn more about Atlas Vector Search, see :atlas:`Atlas Vector Search </atlas-vector-search/>` | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||
in the Atlas documentation. | ||||||||
|
||||||||
API Documentation | ||||||||
~~~~~~~~~~~~~~~~~ | ||||||||
|
||||||||
To learn more about the ``aggregate()`` method, see the | ||||||||
`API documentation <{+api+}/classes/Collection.html#aggregate>`__. | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
S: Be specific in your hypertext links |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
S: Too make the title a bit more descriptive
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm leaning towards keeping the title the same for consistency: this page is the one after the Atlas Search page already merged in: 9e31836 which is just called Atlas Search, and in our other docs that have avs pages they are all just titled atlas vector search https://www.mongodb.com/docs/drivers/kotlin/coroutine/current/fundamentals/builders/vector-search/, https://www.mongodb.com/docs/drivers/csharp/current/fundamentals/atlas-vector-search/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Titles should be between 30-60 characters (maintenance wiki). I'm going to add a check to the PR Checklist next week to make sure we check for title length!
Also, this page aligns with the content on the "Run Vector Search Queries" page of the Atlas docs, so I think it makes sense to have a similar title. Let me know what you think!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, sounds good, I'm good with following the title guidelines!