Skip to content

Commit

Permalink
DOCSP-45930 Atlas Search Query Prep (#705)
Browse files Browse the repository at this point in the history
* DOCSP-45930 Atlas Search Query Prep

* *

* *

* *

* separate aggregation step

* SO feedback

* *

* *

* BB edits

* nit
  • Loading branch information
ajhuh-mdb authored Dec 20, 2024
1 parent 0fea6eb commit 3e81f2c
Show file tree
Hide file tree
Showing 8 changed files with 43 additions and 33 deletions.
2 changes: 1 addition & 1 deletion source/documents/modify-multiple.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ About this Task

- Previews of the documents affected by bulk update operations are
only visible if your database is configured to support transactions.
For details, see :ref:`transactions`.
For details, see :manual:`</core/transactions>`.

.. BEGIN-COMPASS-ONLY

Expand Down
4 changes: 4 additions & 0 deletions source/export-query-to-language.txt
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,11 @@ Procedure
:figwidth: 600px
:alt: Copy button clicked in Export Query to Language modal

.. BEGIN-COMPASS-ONLY

Learn More
----------

- :ref:`compass-export-agg-builder-results`

.. END-COMPASS-ONLY
Binary file modified source/images/compass/field-percentage-breakdown.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified source/images/compass/mixed-sample.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified source/images/compass/mixed-sample2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 0 additions & 4 deletions source/indexes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,6 @@ Create an Index

.. include:: /includes/shared/steps/create-index.rst

.. BEGIN-COMPASS-ONLY

Create an Atlas Search Index
~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Expand All @@ -97,8 +95,6 @@ Atlas Vector Search indexes enable you to index vector data *and* other data
types, which facilitates semantic searches on the indexed fields. For more
information, see :ref:`compass-create-vector-search`.

.. END-COMPASS-ONLY

.. _compass-wildcard-index:

Create a Wildcard Index
Expand Down
60 changes: 35 additions & 25 deletions source/query/atlas-search.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,25 @@ Run Atlas Search Queries
:depth: 1
:class: singlecol

You can run Atlas Search :pipeline:`$search` and :pipeline:`$searchMeta`
queries from |compass| if you :ref:`created the Atlas Search index
<compass-create-search-index>` for data on the Atlas cluster. You can
also run :pipeline:`$vectorSearch` queries from |compass| if you have an
existing Atlas Vector search index on your data in Atlas.
Atlas Search queries are run as an :ref:`aggregation pipeline stage
<compass-agg-builder>`. If you have an existing Atlas Search Index for data on
your Atlas cluster, you can run :pipeline:`$search` and :pipeline:`$searchMeta`
queries. If you have an existing Atlas Vector search index on your data in
Atlas, you can also run :pipeline:`$vectorSearch` queries.

Before You Begin
----------------

Create an :ref:`Atlas Search index <compass-create-search-index>` or an
:ref:`Atlas Vector Search index <compass-create-vector-search>`.

.. note::

Atlas Search index management in the |compass-short| UI is available only
for:

- Atlas local deployments.
- Deployments running MongoDB 7.0 or later.

Steps
-----
Expand All @@ -25,32 +39,28 @@ Steps
:style: normal

.. step:: Find the index you want to use in your query

a. From the :guilabel:`Indexes` tab, click :guilabel:`Search Indexes`.
#. Hover over the index you want to use in your query.

.. step:: Run the query
From the :guilabel:`Indexes` tab, click :guilabel:`Search Indexes`.
Hover over the search index you want to use in your query.

a. Click the :guilabel:`Aggregate` button.

|compass| switches to the :guilabel:`Aggregations` tab where you
can run your query.

#. Construct your query.
.. step:: Open the aggregation pipeline builder

Click the :guilabel:`Aggregate` button that appears when you hover over
your search index.

By default, |compass| selects the :pipeline:`$search` stage for
your query. You can select the :pipeline:`$searchMeta` stage
to use in your query. If you are using a ``vectorSearch`` type
index in your query, you can only use the
:pipeline:`$vectorSearch` stage in your query.
.. step:: Construct your query

By default, |compass| selects the :pipeline:`$search` stage for your
query. You can also select the :pipeline:`$searchMeta` stage to use in
your query. If you are using a ``vectorSearch`` type index in your query,
you can use the :pipeline:`$vectorSearch` stage.

.. note::
.. note::

The Atlas Search :pipeline:`$search` and :pipeline:`$searchMeta` and
the Atlas Vector Search :pipeline:`$vectorSearch` pipeline stages must
be the first stage in your aggregation pipeline.
If you use the ``$search``, ``$searchMeta``, or ``$vectorSearch``
stage, it must be the first stage in your aggregation pipeline.

#. Click :guilabel:`Run` to run your query.
.. step:: Run your query

Learn More
----------
Expand Down
6 changes: 3 additions & 3 deletions source/schema.txt
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,8 @@ For fields that contain multiple data types,
|compass-short| displays a percentage breakdown of
the various data types across documents. In the example below,
the chart shows the contents of a field called ``phone_no`` in which
81% of documents are of type ``string``, and the remaining 19% are of
type ``number``.
20% of documents are of type ``int32``, and the remaining 80% are of
type ``string``.

.. figure:: /images/compass/field-percentage-breakdown.png
:figwidth: 330px
Expand Down Expand Up @@ -239,7 +239,7 @@ field shows the values that are strings:
:figwidth: 574px
:alt: Example of a field with mixed types

Clicking on the ``number`` type causes the chart to show its numeric
Clicking on the ``int32`` type causes the chart to show its numeric
data:

.. figure:: /images/compass/mixed-sample2.png
Expand Down

0 comments on commit 3e81f2c

Please sign in to comment.