Docs Menu
Docs Home
MongoDB Atlas
/ / / /

Parallelize Query Execution Across Segments

On this page

  • Syntax
  • Behavior
  • Limitation
  • Example

The concurrent option enables intra-query parallelism. In this mode, Atlas Search utilizes more resources, but improves each individual query latency. This feature is only available for dedicated Search Nodes.

concurrent has the following syntax:

"$searchMeta"|"$search": {
"index": "<index name>", // optional, defaults to "default"
"<operator>": {
"concurrent": true | false,

The concurrent boolean option allows you to request Atlas Search to parallelize query execution across segments, which, in many cases, improves the response time. You can set one of the following values for the concurrent option:

  • true - to request Atlas Search to run the query multi-threaded

  • false - to run the query single-threaded (default)

Atlas Search provides you control over this behavior on a per-query basis to enable concurrent execution only for heavy and long-running queries, which minimizes the contention and improves overall query throughput. Concurrent execution is especially efficient on large datasets, as there is a larger amount of segments.

When you run queries with the concurrent option, Atlas Search doesn't guarantee that each query will be executed concurrently. For example, when too many concurrent queries are queued, Atlas Search might fallback to single-threaded execution.

Consider the following query against the sample_mflix.movies collection in the sample data. The query indicates a concurrent search for movies that contain the term new york in the title.

2 {
3 "$search": {
4 "text": {
5 "path": "title",
6 "query": "new york"
7 },
8 "concurrent": true
9 }
10 }
← 1. Sort Results