My Library Docs

Multi-root Sidebar

flex-layout

  • Getting Started

  • Guides

  • Reference

typed-rx-http

  • Getting Started

  • Guides

  • Reference

global-rx-state

  • Getting Started

  • Guides

  • Reference

webflux-fe-dev-assistant

reactive-mongo-dsl

Atlas Search

Configure the Atlas Search operator, compound/filter, score, highlight, sequence token, paging/count, and Driver-native extension paths based on version 1.0.0.


Basic Atlas Search
java

$search and $searchMeta must be the first stage of the aggregation pipeline, so they are separated from the general fields(...).end() flow. You can also use .search() without an index.

Search operator

root builder: text, phrase, autocomplete, equals, exists, in, range, compound

reusable clause: SearchOperators.text/phrase/autocomplete/equals/in/exists/range

Driver-native root operator: operator(SearchOperator)

named Driver wrapper: SearchOperators.driver(name, operator)

java

compound supports must, mustNot, should, filter, minimumShouldMatch, and score, and you can also directly pass a general AtlasSearchOperator.

Text / Phrase / Autocomplete
java

text: path(s), query(ies), fuzzy, matchCriteria, synonyms, score

phrase: path(s), query(ies), slop, synonyms, score

autocomplete: single path, query(ies), tokenOrder, fuzzy, score

Do not use fuzzy(...) and synonyms(...) simultaneously.

Difference between Search clause and post-search fields
java

search().fields(...) is a general $match after $search, not an internal filter of $search. To limit candidates at the search index stage, use compound.filter(...).

text
Score and Sorting
java

scoreDesc()/scoreAsc() and general sort determine priority in the order they are called. For stable pagination, it is advisable to include stable unique field sorting along with the score.

Highlight / score details / sequence token
java

The default aliases are highlights, scoreDetails, searchSequenceToken. addFieldsScoreDetails() also activates score details in the Search option.

Paging / sequence token / count
java

count().execute()

The final pipeline count reflecting post-search fields(...) and score threshold.

count().executeSearchMeta()

$searchMeta metadata count. Supports SearchCountType.TOTAL/LOWER_BOUND and does not execute post-search $match.

existsQuery().execute()

Checks if there is more than one result in the Search pipeline.

Driver-native extension
java

stage(Bson) is placed immediately after $search and is not applied to the $searchMeta metadata-count pipeline of executeSearchMeta(). If new Driver features are added before the DSL convenience API, prioritize using operator, driverOptions, stage, SortSpec.driver, and customizeAggregation.

© 2026 Byeolnaerim. All rights reserved.IntroductionPrivacy Policy