@@ -124,3 +124,81 @@ To ``$explain`` an aggregation pipeline, call the
124124 Aggregates.group("$stars", Accumulators.sum("count", 1))))
125125 .explain()
126126 .subscribe(new PrintDocumentSubscriber());
127+
128+ .. _java-rs-atlas-search-stage:
129+
130+ Atlas Search
131+ ------------
132+
133+ You can perform an :atlas:`Atlas Search </atlas-search>` query by creating and running
134+ an aggregation pipeline that contains one of the following pipeline stages:
135+
136+ - ``$search``
137+ - ``$searchMeta``
138+
139+ The {+driver-short+} provides the `Aggregates.search()
140+ <{+core-api+}/client/model/Aggregates.html#search(com.mongodb.client.model.search.SearchOperator)>`__
141+ and `Aggregates.searchMeta()
142+ <{+core-api+}/client/model/Aggregates.html#searchMeta(com.mongodb.client.model.search.SearchOperator)>`__
143+ methods to perform Atlas Search queries.
144+
145+ To learn more about Atlas Search pipeline stages, see :atlas:`Choose the
146+ Aggregation Pipeline Stage </atlas-search/query-syntax/>` in the Atlas
147+ documentation.
148+
149+ Create Pipeline Search Stages
150+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
151+
152+ You can create the search criteria in your Atlas Search pipeline stage
153+ by using Search operators.
154+
155+ .. sharedinclude:: dbx/jvm/atlas-search-operator-helpers.rst
156+
157+ .. replacement:: as-idx-link
158+
159+ the :ref:`java-rs-atlas-search-idx-mgmt` section of the Indexes guide
160+
161+ .. replacement:: atlas-query-operators-example
162+
163+ .. io-code-block::
164+
165+ .. input:: /includes/aggregation/atlas-search-examples.java
166+ :language: java
167+ :start-after: // start atlasHelperMethods
168+ :end-before: // end atlasHelperMethods
169+ :dedent:
170+
171+ .. output::
172+ :language: console
173+ :visible: false
174+
175+ {"_id": ..., "genres": ["Comedy", "Romance"], "title": "Love at First Bite", "year": 1979}
176+ {"_id": ..., "genres": ["Comedy", "Drama"], "title": "Love Affair", "year": 1994}
177+
178+ Additional Information
179+ ----------------------
180+
181+ To view a full list of expression operators, see :manual:`Aggregation
182+ Operators </reference/operator/aggregation/>` in the {+mdb-server+} manual.
183+
184+ To learn about assembling an aggregation pipeline and view examples, see
185+ :manual:`Aggregation Pipeline </core/aggregation-pipeline/>` in the {+mdb-server+} manual.
186+
187+ To learn more about creating pipeline stages, see :manual:`Aggregation
188+ Stages </reference/operator/aggregation-pipeline/>` in the {+mdb-server+} manual.
189+
190+ To learn more about explaining MongoDB operations, see
191+ :manual:`Explain Output </reference/explain-results/>` and
192+ :manual:`Query Plans </core/query-plans/>` in the {+mdb-server+} manual.
193+
194+ API Documentation
195+ ~~~~~~~~~~~~~~~~~
196+
197+ To learn more about the classes and methods mentioned in this guide, see
198+ the following API documentation:
199+
200+ - `aggregate() <{+driver-api+}/MongoCollection.html#aggregate(java.util.List)>`__
201+ - `Aggregates <{+core-api+}/client/model/Aggregates.html>`__
202+ - `AggregatePublisher <{+driver-api+}/AggregatePublisher.html>`__
203+ - `search() <{+core-api+}/client/model/Aggregates#search(com.mongodb.client.model.search.SearchOperator)>`__
204+ - `project() <{+core-api+}/client/model/Aggregates#project(org.bson.conversions.Bson)>`__
0 commit comments