|
| 1 | +.. _compass-create-vector-search: |
| 2 | + |
| 3 | +=================================== |
| 4 | +Create an Atlas Vector Search Index |
| 5 | +=================================== |
| 6 | + |
| 7 | +.. contents:: On this page |
| 8 | + :local: |
| 9 | + :backlinks: none |
| 10 | + :depth: 1 |
| 11 | + :class: singlecol |
| 12 | + |
| 13 | +.. versionadded:: 1.42.1 |
| 14 | + |
| 15 | +You can create :atlas:`Atlas Vector Search indexes |
| 16 | +</atlas-vector-search/vector-search-overview/>` using |compass|. These indexes |
| 17 | +enable you to index vector data *and* other data types, which facilitates |
| 18 | +semantic searches on the indexed fields. Atlas Vector Search indexes support |
| 19 | +indexing vector data by identifying the most similar vectors. The index |
| 20 | +determines similarity by calculating the distance between the query vector |
| 21 | +and the vectors stored in the index. |
| 22 | + |
| 23 | +About this Task |
| 24 | +--------------- |
| 25 | + |
| 26 | +To create an Atlas Search index, your deployment must align with one of the |
| 27 | +following cases: |
| 28 | + |
| 29 | +- A deployment hosted on `MongoDB Atlas <https://www.mongodb.com/docs/atlas/>`__ and |
| 30 | + have an Atlas cluster tier of M10 or higher. |
| 31 | + |
| 32 | +- A local deployment that is set up using the `Atlas CLI |
| 33 | + <https://www.mongodb.com/docs/atlas/cli/stable/atlas-cli-deploy-local/>`__. |
| 34 | + |
| 35 | +Additionally, your deployment must run MongoDB version 7.0 or later. |
| 36 | + |
| 37 | +Steps |
| 38 | +----- |
| 39 | + |
| 40 | +.. procedure:: |
| 41 | + :style: normal |
| 42 | + |
| 43 | + .. step:: Open the index creation dialog |
| 44 | + |
| 45 | + From the :ref:`Indexes <indexes-tab>` tab, click the |
| 46 | + :guilabel:`Create` button and then click :guilabel:`Search Index`. |
| 47 | + |
| 48 | + .. step:: Specify a name for the index |
| 49 | + |
| 50 | + .. step:: Select the Atlas Search Index type |
| 51 | + |
| 52 | + Select :guilabel:`Vector Search`. |
| 53 | + |
| 54 | + .. step:: Provide the Atlas Vector Search Index configurations |
| 55 | + |
| 56 | + You must initially provide the following default vector search index |
| 57 | + configurations. You can modify the configurations later. |
| 58 | + |
| 59 | + .. list-table:: |
| 60 | + :header-rows: 1 |
| 61 | + :widths: 20 10 70 |
| 62 | + |
| 63 | + * - Field |
| 64 | + - Type |
| 65 | + - Description |
| 66 | + |
| 67 | + * - ``path`` |
| 68 | + - string |
| 69 | + - The field name to index. |
| 70 | + |
| 71 | + * - ``numDimensions`` |
| 72 | + - int |
| 73 | + - The number of vector dimensions, which Atlas Search enforces at index- and |
| 74 | + query-time. This value can't be greater than 2048. |
| 75 | + |
| 76 | + * - ``similarity`` |
| 77 | + - string |
| 78 | + - The vector similarity function used to search for the top K-nearest neighbors. |
| 79 | + Select from the following functions: |
| 80 | + |
| 81 | + .. list-table:: |
| 82 | + :header-rows: 1 |
| 83 | + :widths: 50 50 |
| 84 | + |
| 85 | + * - Function |
| 86 | + - Description |
| 87 | + |
| 88 | + * - ``euclidean`` |
| 89 | + - A function that measures the distance between ends of vectors. This function |
| 90 | + allows you to measure similarity based on varying dimensions. |
| 91 | + |
| 92 | + * - ``cosine`` |
| 93 | + - A function that measures similarity based on the angle between vectors. This |
| 94 | + function allows you to measure similarity that isn't scaled by magnitude. |
| 95 | + |
| 96 | + You can't use zero magnitude vectors with cosine. To measure cosine similarity, |
| 97 | + we recommend that you normalize your vectors and use dotProduct instead. |
| 98 | + |
| 99 | + * - ``dotProduct`` |
| 100 | + - A function that measures similarly to cosine, but takes into account the |
| 101 | + magnitude of the vector. This function allows you to efficiently measure |
| 102 | + similarity based on both angle and magnitude. To use dotProduct, you must |
| 103 | + normalize the vector to unit length at index- and query-time. |
| 104 | + |
| 105 | + .. step:: Click :guilabel:`Create Search Index` |
| 106 | + |
| 107 | +Example |
| 108 | +------- |
| 109 | + |
| 110 | +The following example definition uses the ``sample_mflix.embedded_movies`` collection |
| 111 | +and indexes the ``plot_embedding`` field to create an Atlas Vector Search index: |
| 112 | + |
| 113 | +.. code-block:: javascript |
| 114 | + |
| 115 | + { |
| 116 | + "fields": [ { |
| 117 | + "type": "vector", |
| 118 | + "path": "plot_embedding", |
| 119 | + "numDimensions": 1536, |
| 120 | + "similarity": "euclidean" |
| 121 | + } ] |
| 122 | + } |
| 123 | + |
| 124 | +Results |
| 125 | +------- |
| 126 | + |
| 127 | +To view the status of your created index, go to the :guilabel:`Indexes` |
| 128 | +tab and set the toggle at the top-right to :guilabel:`Search Indexes`. |
| 129 | + |
| 130 | +The :guilabel:`Status` column indicates the status of the index. When |
| 131 | +the status is :guilabel:`Ready`, your index is ready to use. |
| 132 | + |
| 133 | +For more information on search index statuses, see |
| 134 | +:ref:`search-index-status`. |
| 135 | + |
| 136 | +Learn More |
| 137 | +---------- |
| 138 | + |
| 139 | +- :ref:`compass-indexes` |
| 140 | + |
| 141 | +- :atlas:`How to Index Fields for Vector Search |
| 142 | + </atlas-vector-search/vector-search-type/#std-label-avs-types-vector-search>` |
| 143 | + |
| 144 | +- :atlas:`How to Perform Semantic Search Against Data in Your Atlas Cluster |
| 145 | + </atlas-vector-search/vector-search-tutorial/>` |
0 commit comments