Skip to content

Commit 30c29d9

Browse files
authored
Merge pull request #221 from davidhou17/DOCSP-32412
(DOCSP-32412): Improves and updates tutorials in Atlas Search guide
2 parents b11a0cd + cf0bb5c commit 30c29d9

File tree

6 files changed

+194
-145
lines changed

6 files changed

+194
-145
lines changed

source/includes/create_index_sample_sales.rst

Lines changed: 0 additions & 18 deletions
This file was deleted.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
.. step:: Navigate to the {+db-deployments+} page for your project.
2+
3+
.. step:: Click on your cluster name.
4+
5+
.. figure:: /images/sample-data-cluster.png
6+
:figwidth: 600px
7+
:alt: sample-data-cluster

source/search/compound.txt

Lines changed: 46 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,18 @@ Overview
2222
Retrieve documents in MongoDB with a query on multiple fields.
2323

2424
In this guide, you will learn how to use multiple search operators in
25-
a compound query using the aggregation pipeline.
25+
a compound query by using the aggregation pipeline.
2626

27-
.. time:: 15
27+
.. time:: 5
2828

2929
What You'll Need
3030
----------------
3131

3232
- A MongoDB account. See :ref:`guides-create-atlas-account`.
3333
- An Atlas cluster. See :ref:`guides-create-a-cluster`.
3434
- Sample datasets :ref:`loaded into your cluster <guides-load-sample-data>`.
35-
- A search index with default settings and dynamic indexing. See
36-
:ref:`guides-search-dynamic`.
35+
- A search index with default settings and dynamic indexing.
36+
To create a default dynamic index, see :ref:`guides-search-dynamic`.
3737

3838
Procedure
3939
---------
@@ -43,79 +43,83 @@ Procedure
4343

4444
.. include:: /includes/navigate_to_collections.rst
4545

46-
.. step:: In the right-hand pane, click ``sample_supplies``,
46+
.. step:: Click the ``sample_supplies`` database,
4747
then click the ``sales`` collection.
4848

49-
.. step:: Run a query on your index using the Aggregation Pipeline.
49+
.. step:: Run a compound query on your index in the :guilabel:`Aggregations` tab.
5050

5151
.. procedure::
5252
:style: connected
5353

5454
.. step:: Click
5555
the :guilabel:`Aggregation` tab.
5656

57-
.. step:: If you do not see a pipeline with an initial
58-
stage window in the right pane, click
59-
:guilabel:`Create New` and select :guilabel:`Pipeline`.
60-
57+
.. step:: Click :guilabel:`+ Add Stage` to begin creating
58+
your aggregation pipeline.
59+
6160
.. step:: In the stage window, click on the dropdown menu
62-
labeled :guilabel:`Select...` and select the
61+
labeled :guilabel:`Select` and select the
6362
:guilabel:`$search` stage.
6463

6564
.. step:: Replace the placeholder code with the following
66-
``compound`` operator:
65+
query.
6766

6867
.. code-block:: json
6968

7069
{
71-
"compound": {
72-
"filter": [{
73-
"text": {
74-
"query": "Online",
75-
"path": "purchaseMethod"
76-
}
77-
}],
78-
"should": [{
79-
"text": {
80-
"query": "notepad",
81-
"path": "items"
82-
}
83-
}]
84-
}
70+
"compound": {
71+
"filter": [{
72+
"text": {
73+
"query": "Online",
74+
"path": "purchaseMethod"
75+
}
76+
}],
77+
"should": [{
78+
"text": {
79+
"query": "notepad",
80+
"path": "items"
81+
}
82+
}]
83+
}
8584
}
8685

87-
.. step:: Review the results of the compound search in the
88-
right-hand pane. Your results should include the fields listed
89-
in the following sample document.
86+
This query uses the ``compound`` operator with:
87+
88+
- The ``filter`` clause to return only documents
89+
with a ``purchaseMethod`` of ``Online``.
90+
- The ``should`` clause to return documents
91+
with an ``items`` field that contains ``notepad`` to have
92+
a higher score than those without.
93+
94+
.. step:: Review the results of the compound query.
9095

91-
.. note::
92-
93-
The fields will not always appear in the same order
94-
for every returned document.
96+
In the right-hand pane, your results should include a list
97+
of documents that resemble the following sample document:
9598

9699
.. code-block:: json
97100
:copyable: false
98101

99102
items: Array
103+
0: Object
104+
1: Object
105+
2: Object
106+
name: "notepad"
107+
...
100108
storeLocation: "Denver"
101109
customer: Object
102110
couponUsed: false
103111
purchaseMethod: "Online"
104112
_id: ObjectID('5bd761dcae323e45a93cd06e')
105113
saleDate: 2013-11-22T18:49:45.212+00:00
106114

115+
.. note::
116+
117+
The fields don't always appear in the same order
118+
for every returned document.
119+
107120
You can expand ``Array`` and ``Object`` fields to view their
108121
contents by clicking on them.
109122

110-
Due to the ``filter`` operator, only records with a
111-
``purchaseMethod`` value of ``Online`` appear.
112-
Additionally, due to the ``should`` operator,
113-
records with an ``items`` value of ``notepad`` score
114-
higher than those without.
115-
116-
You now have a ``$search`` aggregation stage with a compound
117-
search definition.
118-
119123
Summary
120124
-------
121125

source/search/dynamic.txt

Lines changed: 31 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,11 @@ Overview
2121

2222
Retrieve documents in MongoDB with full-text search.
2323

24-
In this guide, you will learn how to create a search index
25-
for relevance-based search as an alternative to document-based search.
24+
In this guide, you will learn how to create an :ref:`Atlas Search index
25+
<ref-create-index>` with :ref:`dynamic mappings
26+
<static-dynamic-mappings>` to query and quickly retrieve relevant data.
2627

27-
.. time:: 15
28+
.. time:: 5
2829

2930
What You'll Need
3031
----------------
@@ -39,35 +40,50 @@ Procedure
3940
.. procedure::
4041
:style: normal
4142

42-
.. include:: /includes/navigate_to_collections.rst
43+
.. include:: /includes/navigate_to_cluster.rst
4344

4445
.. step:: Create a dynamic search index.
4546

46-
.. include:: /includes/create_index_sample_sales.rst
47+
.. procedure::
48+
:style: connected
49+
50+
.. step:: Click the :guilabel:`Search` tab.
51+
52+
.. step:: Click
53+
:guilabel:`Create Search Index`.
4754

48-
.. step:: Click :guilabel:`Create Search Index`. Wait for the
49-
:guilabel:`Status` column to read :guilabel:`Active`.
55+
.. step:: Select the :guilabel:`Visual Editor` configuration
56+
method, then click :guilabel:`Next`.
5057

51-
You now have a search index definition. This definition
52-
recursively indexes fields of
53-
:ref:`many common data types <bson-data-chart>` across indexed
54-
documents.
58+
.. step:: For the :guilabel:`Database and Collection`, select the
59+
``sample_supplies`` database and the ``sales`` collection.
60+
Then, click :guilabel:`Next`.
5561

56-
.. step:: Click :guilabel:`QUERY`
57-
in the :guilabel:`Actions` column of your index definition.
62+
.. step:: Click :guilabel:`Create Search Index` to confirm your
63+
selection. Wait for the :guilabel:`Status` column to read
64+
:guilabel:`Active`.
65+
66+
You now have a search index that
67+
:ref:`dynamically indexes <static-dynamic-mappings>` the fields
68+
across the documents in your collection.
5869

5970
.. step:: Run a query on your index.
6071

6172
.. procedure::
6273
:style: connected
6374

75+
.. step:: Click :guilabel:`Query`
76+
in the :guilabel:`Actions` column of your index definition.
77+
6478
.. step:: Type ``notepad`` into the search bar, then click
6579
:guilabel:`Search`.
80+
81+
This query returns all documents in the ``sales`` collection with
82+
a field that contains ``notepad``.
6683

6784
.. step:: Review the results.
6885

69-
Your results should include the fields listed in the following
70-
sample documents.
86+
Your results should resemble the following sample documents:
7187

7288
.. code-block:: json
7389
:copyable: false

0 commit comments

Comments
 (0)