> For the complete MongoDB documentation index, see www.mongodb.com/docs/llms.txt

<!--
Tab options on this page. Append to the .md URL to filter:
  ?tabs=<id,...>   select specific tabs (e.g. ?tabs=nodejs,shell)
  ?allTabs=true    include every tab
  (no param)       default: one tab per tabset

Available tabs:
  other tabs: ann, enn, trace-documents
-->

# Explain MongoDB Vector Search Results

When you run a MongoDB Vector Search query with the `explain` method, the query returns a BSON (Binary Javascript Object Notation) document containing query plan and execution statistics that describe how the query was run internally.

**See also:**

[explain command](https://www.mongodb.com/docs/manual/reference/command/explain/)

## Syntax

```json
db.<myCollection>.explain("<verbosity>").aggregate([
   {
     "$vectorSearch": {
       "exact": true | false,
       "filter": {<filter-specification>},
       "index": "<index-name>",
       "limit": <number-of-results>,
       "numCandidates": <number-of-candidates>,
       "path": "<field-to-search>",
       "queryVector": [<array-of-numbers>],
       "explainOptions": {
         "traceDocumentIds": [<array-of-document-IDs>]
       }
     }
   }
])
```

## Verbosity

Verbosity mode controls the behavior of `explain` and the amount of information returned. Value can be one of the following, in order of decreasing verbosity:

| [allPlansExecution](https://www.mongodb.com/docs/manual/reference/explain-results.md#std-label-executionStats) | Information about the query plan including the `stats` fields, which contain execution statistics for the query. Includes partial execution data captured during plan selection. |
| --- | --- |
| [executionStats](https://www.mongodb.com/docs/manual/reference/explain-results.md#std-label-executionStats) | Information about the query plan including the `stats` fields, which contain execution statistics for the query. |
| [queryPlanner](https://www.mongodb.com/docs/manual/reference/explain-results.md#std-label-queryPlanner) (default) | Information about the query plan. Does not include the `stats` fields, which contain execution statistics for the query. |

**See also:**

[Verbosity Modes](https://www.mongodb.com/docs/manual/reference/command/explain/#verbosity-modes)

## Explain Results

The `explain` method returns a BSON (Binary Javascript Object Notation) document with the following fields.

| Option | Type | Necessity | Purpose |
| --- | --- | --- | --- |
| `collectors` | document | Optional | Describes the execution statistics for the collector. |
| `metadata` | document | Optional | Contains useful metadata. |
| `query` | document | Optional | Describes the execution statistics for the query. This is not present at the top level for `indexPartitionExplain`. |
| `resultMaterialization` | document | Optional | Details related to retrieving per-document data after query execution. This is not returned for `queryPlanner` verbosity mode. |
| `resourceUsage` | document | Optional | Details the resource usage of the query when it was executed. This is not returned for `queryPlanner` verbosity mode. |
| `vectorTracing` | array of objects | Optional | Tracing details, such as the following, about vectors in the specified documents: Whether MongoDB Vector Search visited the vector during query execution, whether the vector appeared in the MongoDB Vector Search result set, and if not, why the vector was dropped.; Whether the vector is generally reachable because some vectors might not be reachable due to [Hierarchical Navigable Small Worlds](https://arxiv.org/abs/1603.09320)'s probabilistic nature. |
| `luceneVectorSegmentStats` | array of objects | Optional | Per-Lucene segment details of [`$vectorSearch`](https://www.mongodb.com/docs/vector-search/query/aggregation-stages/vector-search-stage.md#mongodb-pipeline-pipe.-vectorSearch) query execution. |

### `collectors`

The `collectors` is a BSON (Binary Javascript Object Notation) document with the following field:

| Field | Type | Necessity | Purpose |
| --- | --- | --- | --- |
| `allCollectorStats` | document | Required | Statistics of all collectors of the query. Statistics reported represent either the maximum value across all collectors used in the query or a sum of the statistic across all the sub-collectors. The timing statistics are summed to reflect the total time spent across all collectors for the entire query. To learn more, see [`allCollectorStats`.](https://www.mongodb.com/docs/vector-search/query/explain.md#std-label-avs-explain-search-all-collector-stats) |

#### `allCollectorStats`

The `allCollectorStats` is a BSON (Binary Javascript Object Notation) document that describes collector statistics across all collectors specified in the query. It contains the following keys:

| Field | Description |
| --- | --- |
| `collect` | Tracks the duration and number of results collected by the collector. |
| `competitiveIterator` | Statistics tracking the total duration and the number of times a `competitiveIterator` was requested from the collector. |
| `setScorer` | Statistics tracking the total duration and number of times a scorer was set on the collector. |

### `metadata`

The `metadata` contains helpful metadata, such as the following:

| Field | Type | Necessity | Purpose |
| --- | --- | --- | --- |
| `mongotVersion` | String | Optional | Current version of `mongot`. |
| `mongotHostName` | String | Optional | Human readable label that identifies the `mongot` host. |
| `indexName` | String | Optional | MongoDB Vector Search index used in the query. |
| `cursorOptions` | Document | Optional | Cursor options given to `mongot`. |
| `totalLuceneDocs` | Integer | Optional | Total number of documents in the index including deleted documents. |

### `query`

The `explain` response is a BSON (Binary Javascript Object Notation) document with keys and values describing the execution statistics for the query. The `explain` document in the result set contains the following fields:

| Field | Type | Necessity | Purpose |
| --- | --- | --- | --- |
| `path` | string | Optional | Path to the queried embedding field, only if it isn't the root. |
| `type` | string | Required | Name of the type of vector search query. See `query` for more information. |
| `args` | document | Required | Vector search query information. See `query` for more information. |
| `stats` | document | Optional | [`stats`](https://www.mongodb.com/docs/vector-search/query/explain.md#std-label-avs-explain-timing-breakdown) for the query if `explain` ran with `executionStats` or `allPlansExecution` verbosity. |

#### `args`

The [explain response](https://www.mongodb.com/docs/vector-search/query/explain.md#std-label-avs-explain-response) contains information how the query was executed internally. The `args` field includes the following details:

- Query type

- A structured summary example for each query type

- Query options in the structured summary

The following sections describe the query types and the fields in the structured summaries:

A wrapper query used for ANN (Approximate Nearest Neighbor) vector search that combines multiple queries. The structured summary includes details on the following option:

| Field | Type | Necessity | Description |
| --- | --- | --- | --- |
| `query` | Array | Required | Array of sub-queries used in the vector search, typically containing `KnnFloatVectorQuery` and `DocAndScoreQuery`. |

A query type specific to ANN (Approximate Nearest Neighbor) search on float vectors. The structured summary includes details on the following options:

| Field | Type | Necessity | Description |
| --- | --- | --- | --- |
| `field` | String | Required | The vector field path being searched. |
| `k` | Integer | Required | Number of nearest neighbors to retrieve. |

A query type that handles document matching and scoring. The structured summary typically includes statistics about query execution.

A query type for ENN (Exact Nearest Neighbor) vector searches. The structured summary includes details on the following options:

| Field | Type | Necessity | Description |
| --- | --- | --- | --- |
| `field` | String | Required | The vector field path being searched. |
| `similarityFunction` | String | Required | The similarity function used (`dotProduct`, `cosine`, or `euclidean`). |
| `filter` | Document | Optional | Pre-filter query that limits the vector search scope. |

If you use a pre-filter in your vector search query, your explain results include the `BooleanQuery` type. To learn more about the fields for this type and other query types specific to your pre-filter query, refer to the Query Types on the [MongoDB Search Explain Page.](https://www.mongodb.com/docs/search/query/explain.md#std-label-explain-lucene-query)

Queries that are not explicitly defined by another query are serialized using the default query. The structured summary includes details on the following option:

| Field | Type | Necessity | Description |
| --- | --- | --- | --- |
| `queryType` | String | Required | Type of query. |

#### `stats`

The `explain` response for [executionStats](https://www.mongodb.com/docs/manual/reference/explain-results.md#std-label-executionStats) and [allPlansExecution](https://www.mongodb.com/docs/manual/reference/explain-results.md#std-label-executionStats) verbosity modes includes a `stats` field that contains information on how much [time](https://www.mongodb.com/docs/vector-search/query/explain.md#std-label-avs-timing-breakdown) a query spends in various [stages of query](https://www.mongodb.com/docs/vector-search/query/explain.md#std-label-avs-areas-of-query) execution.

##### Timing Breakdown

The timing breakdown describes execution statistics pertinent to an [areas of query](https://www.mongodb.com/docs/vector-search/query/explain.md#std-label-avs-areas-of-query) execution. The following fields show the timing breakdown:

| Field | Type | Description |
| --- | --- | --- |
| `millisElapsed` | Long | Approximate wall-clock time elapsed performing tasks in this [area](https://www.mongodb.com/docs/vector-search/query/explain.md#std-label-avs-areas-of-query) including the amount of time the children of the query spent in this [area](https://www.mongodb.com/docs/vector-search/query/explain.md#std-label-avs-areas-of-query). The value is approximate number of milliseconds elapsed while performing tasks in this area. |
| `invocationCounts` | Document | Number of invocations of tasks included in this [area](https://www.mongodb.com/docs/vector-search/query/explain.md#std-label-avs-areas-of-query). The value is a map of task names to their invocation count. |

##### Areas of Query

Statistics are available for the following areas of query:

| Option | Description |
| --- | --- |
| `context` | Statistics related to the execution of the vector search query. There are two tasks whose invocation counts are enumerated in this area: `createScorer`: Scorer iterates over documents and generates a score for each document. Invocations of `createScorer` create the object responsible for scoring. Note that time associated with this task is not time spent actually scoring documents. Count includes the number of `scorerSupplier` invocations.; `createWeight`: Weight stores state associated with a query and `IndexSearcher`. Count includes the number of `createWeight` invocations. The [time](https://www.mongodb.com/docs/vector-search/query/explain.md#std-label-avs-timing-breakdown) spent in this area is related to the structure of the query, and is not based on the number of results that are iterated through and scored. For example: `"context" : {
  "millisElapsed" : NumberDouble(4.934751),
  "invocationCounts" : {
    "createWeight" : NumberLong(1),
    "createScorer" : NumberLong(10)
  }
}` |
| `match` | Statistics related to iterating over and matching result documents. This statistic shows the time it takes to determine which document is the next match. Time spent matching results can vary significantly depending on the nature of the query. There are two tasks whose invocation counts are enumerated in this area: `nextDoc`: Requests to advance to the next document of the result set. This involves identifying and moving past skips, or other tasks necessary to find the next match. Count includes the number of `nextDoc` and `advance` invocations.; `refineRoughMatch`: Performs a more thorough match. Some queries execute in a two-phase process where a document is first "roughly" matched, and is checked with a second, more thorough phase only after satisfying the first rough match. The `refineRoughMatch` task is the second phase of the two-phase process. Count includes the number of `refineRoughMatch` invocations. For example: `"match" : {
  "millisElapsed" : NumberDouble(4.901597),
  "invocationCounts" : {
    "nextDoc" : NumberLong(541),
    "refineRoughMatch" : NumberLong(0)
  }
}` |
| `score` | Statistics related to scoring documents in the result set. There are two tasks whose invocation counts are enumerated in this area: `score`: Scores each document in the result set. Count includes the number of `score` invocations.; `setMinCompetitiveScore`: Ignores documents whose score is less than the given value. Indicates that a query may have been able to reduce the number of scoring operations performed by ignoring documents with scores below some uncompetitive threshold. Count includes the number of `setMinCompetitiveScore` invocations. For example: `"score" : {
  "millisElapsed" : NumberDouble(3.931312),
  "invocationCounts" : {
    "score" : NumberLong(536),
    "setMinCompetitiveScore" : NumberLong(0)
  }
}` |

### `resourceUsage`

The `resourceUsage` document shows the resource used for running the query. It contains the following fields:

| Field | Type | Necessity | Purpose |
| --- | --- | --- | --- |
| `majorFaults` | Long | Required | Number of major page faults, which occur when the system can't find the required data in memory resulting in reading from the backing store such as disk, during query execution. |
| `minorFaults` | Long | Required | Number of minor page faults, which occur when the data is in the page cache, but hasn't yet been mapped to the process' page table. |
| `userTimeMs` | Long | Required | Amount of CPU time, in milliseconds, spent in user space. |
| `systemTimeMs` | Long | Required | Amount of CPU time, in milliseconds, spent in system space. |
| `maxReportingThreads` | Integer | Required | Maximum number of threads that `mongot` used during query execution across all batches. For non-concurrent explain queries, the value is `1`. |
| `numBatches` | Integer | Required | Total number of batches that `mongot` was requested when processing the query. |

### `vectorTracing`

The `vectorTracing` array contains list of objects, one per document, which has the following details about the vectors in the document:

| Field | Type | Necessity | Purpose |
| --- | --- | --- | --- |
| `visited` | Boolean | Required | Flag that specifies whether the traced vector was visited during query execution. |
| `dropReason` | String | Conditional | Reason for dropping the vector. This is present only if vector was visited and dropped from the results. Value can be: `Merge`; `NonCompetitiveScore`; `Filter`; `Rescoring` |
| `vectorSearchScore` | Double | Conditional | Score associated with the vector. This is present only if vector was visited |
| `luceneSegment` | Integer | Required | Lucene segment number to which the vector belongs. To learn more, see [`luceneVectorSegmentStats`.](https://www.mongodb.com/docs/vector-search/query/explain.md#std-label-avs-explain-lucene-vector-segment-stats) |
| `unreachable` | Boolean | Conditional | Flag that specifies whether the vector is unreachable. This is present only if the vector is unreachable. |

### `luceneVectorSegmentStats`

The `luceneVectorSegmentStats` array of objects contain per-Lucene segment breakdown of the [`$vectorSearch`](https://www.mongodb.com/docs/vector-search/query/aggregation-stages/vector-search-stage.md#mongodb-pipeline-pipe.-vectorSearch) query execution. Each segment is identified by a number and includes the parameters that describe the query execution details.

```javascript
{
  "0": {
    "executionType": "Approximate",
    "approximateTimeMillis": 0.10825,
    "filterMatchedDocsCount": 0,
    "docCount": 100
  },
  "1": {
    "executionType": "Exact",
    "exactTimeMillis": 0.10825,
    "filterMatchedDocsCount": 0,
    "docCount": 55
  },
  "2": {
    "executionType": "ApproximateToExactFallback",
    "approximateTimeMillis": 0.10825,
    "exactTimeMillis": 0.10825,
    "filterMatchedDocsCount": 0,
    "docCount": 55
  }
}
```

| Field | Type | Necessity | Purpose |
| --- | --- | --- | --- |
| `executionType` | String | Required | The execution strategy. Value can be one of the following: `Approximate`; `Exact`; `ApproximateToExactFallback` |
| `approximateStage` | Float | Conditional | Time (in milliseconds) for the approximate phase. This is returned only for `Approximate` and `ApproximateFallbackToExact` execution types. |
| `exactStage` | Float | Conditional | Time (in milliseconds) for the Exact phase. This is returned only for `Exact` and `ApproximateFallbackToExact` execution types. |
| `filterMatchedDocsCount` | Integer | Optional | The number of documents that matched the query filter if you specified a prefilter in the query. |
| `docCount` | Integer | Required | Total number of documents in the segment. |

## Examples

The following examples use the `explain` method on sample ANN (Approximate Nearest Neighbor) and ENN (Exact Nearest Neighbor) queries. If you want to run the following examples in your own environment, you must first complete the [MongoDB Vector Search Quick Start](https://www.mongodb.com/docs/vector-search/tutorials/quick-start.md#std-label-vector-search-quick-start) using [`mongosh`.](https://www.mongodb.com/docs/mongodb-shell.md#mongodb-binary-bin.mongosh)

### `allPlansExecution`

The following example runs the explain method on an ANN (Approximate Nearest Neighbor) and ENN (Exact Nearest Neighbor) vector search query for the `plot_embedding_voyage_3_large` field with the `allPlansExecution` [verbosity](https://www.mongodb.com/docs/search/query/explain.md#std-label-explain-verbosity) mode.

### ANN

```shell
db.embedded_movies.explain("allPlansExecution").aggregate([
  {
    "$vectorSearch": {
      "index": "vector_index",
      "path": "plot_embedding_voyage_3_large",
      "queryVector": QUERY_EMBEDDING,
      "numCandidates": 150,
      "limit": 10
    }
  }
])
```

**Output:**

```json
{
  explainVersion: '1',
  stages: [
    {
      '$vectorSearch': {
        index: 'vector_index',
        path: 'plot_embedding_voyage_3_large',
        queryVector: 'redacted',
        numCandidates: 150,
        limit: 10,
        explain: {
          query: {
            type: 'WrappedKnnQuery',
            args: {
              query: [
                {
                  type: 'InstrumentableKnnFloatVectorQuery',
                  args: {
                    field: '$type:knnVector/plot_embedding_voyage_3_large',
                    k: 150
                  },
                  stats: {
                    context: { millisElapsed: 0 },
                    match: { millisElapsed: 0 },
                    score: { millisElapsed: 0 }
                  }
                },
                {
                  type: 'DocAndScoreQuery',
                  args: {},
                  stats: {
                    context: {
                      millisElapsed: 1.378949,
                      invocationCounts: {
                        createWeight: Long('1'),
                        createScorer: Long('4')
                      }
                    },
                    match: {
                      millisElapsed: 0.341389,
                      invocationCounts: { nextDoc: Long('152') }
                    },
                    score: {
                      millisElapsed: 0.205415,
                      invocationCounts: {
                        score: Long('150'),
                        setMinCompetitiveScore: Long('26')
                      }
                    }
                  }
                }
              ]
            },
            stats: {
              context: {
                millisElapsed: 57.285674,
                invocationCounts: {
                  vectorExecution: Long('1'),
                  createWeight: Long('1'),
                  createScorer: Long('4')
                }
              },
              match: {
                millisElapsed: 0.341389,
                invocationCounts: { nextDoc: Long('152') }
              },
              score: {
                millisElapsed: 0.205415,
                invocationCounts: {
                  score: Long('150'),
                  setMinCompetitiveScore: Long('26')
                }
              }
            }
          },
          collectors: {
            allCollectorStats: {
              millisElapsed: 0.840381,
              invocationCounts: {
                collect: Long('150'),
                competitiveIterator: Long('2'),
                setScorer: Long('2')
              }
            }
          },
          metadata: {
            mongotVersion: '1.54.0',
            mongotHostName: '<hostname>.mongodb.net',
            indexName: 'vector_index',
            lucene: { totalSegments: 2, totalDocs: 3483 }
          },
          resourceUsage: {
            majorFaults: Long('0'),
            minorFaults: Long('0'),
            userTimeMs: Long('0'),
            systemTimeMs: Long('0'),
            maxReportingThreads: 1,
            numBatches: 1
          },
          luceneVectorSegmentStats: [
            {
              id: '_0',
              executionType: 'Approximate',
              docCount: 1952,
              approximateStage: { millisElapsed: 32.916505 }
            },
            {
              id: '_1',
              executionType: 'Approximate',
              docCount: 1531,
              approximateStage: { millisElapsed: 8.661519 }
            }
          ]
        }
      },
      nReturned: Long('10'),
      executionTimeMillisEstimate: Long('256')
    },
    {
      '$_internalSearchIdLookup': {
        limit: Long('10'),
        subPipeline: [
          { '$match': { _id: { '$eq': '_id placeholder' } } }
        ],
        totalDocsExamined: Long('10'),
        totalKeysExamined: Long('10'),
        numDocsFilteredByIdLookup: Long('0')
      },
      nReturned: Long('10'),
      executionTimeMillisEstimate: Long('256')
    }
  ],
  queryShapeHash: '2E39BED257F2B59D3F8652E1A81A18B1140602C4E253DED9FE208D584EA00083',
  serverInfo: {
    host: '<hostname>.mongodb.net',
    port: 27017,
    version: '8.2.1-rc1',
    gitVersion: '3312bdcf28aa65f5930005e21c2cb130f648b8c3'
  },
  serverParameters: {
    internalQueryFacetBufferSizeBytes: 104857600,
    internalQueryFacetMaxOutputDocSizeBytes: 104857600,
    internalLookupStageIntermediateDocumentMaxSizeBytes: 104857600,
    internalDocumentSourceGroupMaxMemoryBytes: 104857600,
    internalQueryMaxBlockingSortMemoryUsageBytes: 104857600,
    internalQueryProhibitBlockingMergeOnMongoS: 0,
    internalQueryMaxAddToSetBytes: 104857600,
    internalDocumentSourceSetWindowFieldsMaxMemoryBytes: 104857600,
    internalQueryFrameworkControl: 'trySbeRestricted',
    internalQueryPlannerIgnoreIndexWithCollationForRegex: 1
  },
  command: {
    aggregate: 'embedded_movies',
    pipeline: [
      {
        '$vectorSearch': {
          index: 'vector_index',
          path: 'plot_embedding_voyage_3_large',
          queryVector: [
            -0.034731735,  0.008558298,   -0.0153717, -0.029912498,  0.011549547,
            ...,
            -0.006688767,  0.047527634,  0.040714234
          ],
          numCandidates: 150,
          limit: 10
        }
      }
    ],
    cursor: {},
    '$db': 'sample_mflix'
  },
  ok: 1,
  '$clusterTime': {
    clusterTime: Timestamp({ t: 1759341228, i: 32 }),
    signature: {
      hash: Binary.createFromBase64('BsaUr/khHU1Fyl5/g8htqoavlU8=', 0),
      keyId: Long('7553982574624768005')
    }
  },
  operationTime: Timestamp({ t: 1759341228, i: 32 })
}

```

### `queryPlanner`

The following example runs the explain method on an ANN (Approximate Nearest Neighbor) and ENN (Exact Nearest Neighbor) vector search query for the `plot_embedding_voyage_3_large` field with the `queryPlanner` [verbosity](https://www.mongodb.com/docs/search/query/explain.md#std-label-explain-verbosity) mode.

### ANN

```shell
db.embedded_movies.explain("queryPlanner").aggregate([
  {
    "$vectorSearch": {
      "index": "vector_index",
      "path": "plot_embedding_voyage_3_large",
      "queryVector": QUERY_EMBEDDING,
      "numCandidates": 150,
      "limit": 10
    }
  }
])
```

**Output:**

```json
{
  explainVersion: '1',
  stages: [
    {
      '$vectorSearch': {
        index: 'vector_index',
        path: 'plot_embedding_voyage_3_large',
        queryVector: 'redacted',
        numCandidates: 150,
        limit: 10,
        explain: {
          query: {
            type: 'WrappedKnnQuery',
            args: {
              query: [
                {
                  type: 'InstrumentableKnnFloatVectorQuery',
                  args: {
                    field: '$type:knnVector/plot_embedding_voyage_3_large',
                    k: 150
                  }
                },
                { type: 'DocAndScoreQuery', args: {} }
              ]
            }
          },
          metadata: {
            mongotVersion: '1.54.0',
            mongotHostName: '<hostname>.mongodb.net',
            indexName: 'vector_index',
            lucene: { totalSegments: 2, totalDocs: 3483 }
          }
        }
      }
    },
    {
      '$_internalSearchIdLookup': {
        limit: Long('10'),
        subPipeline: [
          { '$match': { _id: { '$eq': '_id placeholder' } } }
        ]
      }
    }
  ],
  queryShapeHash: '2E39BED257F2B59D3F8652E1A81A18B1140602C4E253DED9FE208D584EA00083',
  serverInfo: {
    host: '<hostname>.mongodb.net',
    port: 27017,
    version: '8.2.1-rc1',
    gitVersion: '3312bdcf28aa65f5930005e21c2cb130f648b8c3'
  },
  serverParameters: {
    internalQueryFacetBufferSizeBytes: 104857600,
    internalQueryFacetMaxOutputDocSizeBytes: 104857600,
    internalLookupStageIntermediateDocumentMaxSizeBytes: 104857600,
    internalDocumentSourceGroupMaxMemoryBytes: 104857600,
    internalQueryMaxBlockingSortMemoryUsageBytes: 104857600,
    internalQueryProhibitBlockingMergeOnMongoS: 0,
    internalQueryMaxAddToSetBytes: 104857600,
    internalDocumentSourceSetWindowFieldsMaxMemoryBytes: 104857600,
    internalQueryFrameworkControl: 'trySbeRestricted',
    internalQueryPlannerIgnoreIndexWithCollationForRegex: 1
  },
  command: {
    aggregate: 'embedded_movies',
    pipeline: [
      {
        '$vectorSearch': {
          index: 'vector_index',
          path: 'plot_embedding_voyage_3_large',
          queryVector: [
            -0.034731735,  0.008558298,   -0.0153717, -0.029912498,  0.011549547,
            ...,
            -0.006688767,  0.047527634,  0.040714234
          ],
          numCandidates: 150,
          limit: 10
        }
      }
    ],
    cursor: {},
    '$db': 'sample_mflix'
  },
  ok: 1,
  '$clusterTime': {
    clusterTime: Timestamp({ t: 1759341765, i: 1 }),
    signature: {
      hash: Binary.createFromBase64('rPjwbtfbjVrbcvkkN0ct/b1UYa8=', 0),
      keyId: Long('7553982574624768005')
    }
  },
  operationTime: Timestamp({ t: 1759341765, i: 1 })
}

```

### `executionStats`

The following example runs the explain method on an ANN (Approximate Nearest Neighbor) and ENN (Exact Nearest Neighbor) vector search query for the `plot_embedding_voyage_3_large` field with the `executionStats` [verbosity](https://www.mongodb.com/docs/search/query/explain.md#std-label-explain-verbosity) mode.

### ANN

```shell
db.embedded_movies.explain("executionStats").aggregate([
  {
    "$vectorSearch": {
      "index": "vector_index",
      "path": "plot_embedding_voyage_3_large",
      "queryVector": QUERY_EMBEDDING,
      "numCandidates": 150,
      "limit": 10
    }
  }
])
```

**Output:**

```json
{
  explainVersion: '1',
  stages: [
    {
      '$vectorSearch': {
        index: 'vector_index',
        path: 'plot_embedding_voyage_3_large',
        queryVector: 'redacted',
        numCandidates: 150,
        limit: 10,
        explain: {
          query: {
            type: 'WrappedKnnQuery',
            args: {
              query: [
                {
                  type: 'InstrumentableKnnFloatVectorQuery',
                  args: {
                    field: '$type:knnVector/plot_embedding_voyage_3_large',
                    k: 150
                  },
                  stats: {
                    context: { millisElapsed: 0 },
                    match: { millisElapsed: 0 },
                    score: { millisElapsed: 0 }
                  }
                },
                {
                  type: 'DocAndScoreQuery',
                  args: {},
                  stats: {
                    context: {
                      millisElapsed: 0.013013,
                      invocationCounts: {
                        createWeight: Long('1'),
                        createScorer: Long('4')
                      }
                    },
                    match: {
                      millisElapsed: 0.459619,
                      invocationCounts: { nextDoc: Long('152') }
                    },
                    score: {
                      millisElapsed: 0.179147,
                      invocationCounts: {
                        score: Long('150'),
                        setMinCompetitiveScore: Long('26')
                      }
                    }
                  }
                }
              ]
            },
            stats: {
              context: {
                millisElapsed: 7.113224,
                invocationCounts: {
                  vectorExecution: Long('1'),
                  createWeight: Long('1'),
                  createScorer: Long('4')
                }
              },
              match: {
                millisElapsed: 0.459619,
                invocationCounts: { nextDoc: Long('152') }
              },
              score: {
                millisElapsed: 0.179147,
                invocationCounts: {
                  score: Long('150'),
                  setMinCompetitiveScore: Long('26')
                }
              }
            }
          },
          collectors: {
            allCollectorStats: {
              millisElapsed: 0.868815,
              invocationCounts: {
                collect: Long('150'),
                competitiveIterator: Long('2'),
                setScorer: Long('2')
              }
            }
          },
          metadata: {
            mongotVersion: '1.54.0',
            mongotHostName: '<hostname>.mongodb.net',
            indexName: 'vector_index',
            lucene: { totalSegments: 2, totalDocs: 3483 }
          },
          resourceUsage: {
            majorFaults: Long('0'),
            minorFaults: Long('0'),
            userTimeMs: Long('0'),
            systemTimeMs: Long('0'),
            maxReportingThreads: 1,
            numBatches: 1
          },
          luceneVectorSegmentStats: [
            {
              id: '_1',
              executionType: 'Approximate',
              docCount: 1531,
              approximateStage: { millisElapsed: 2.58089 }
            },
            {
              id: '_0',
              executionType: 'Approximate',
              docCount: 1952,
              approximateStage: { millisElapsed: 3.483542 }
            }
          ]
        }
      },
      nReturned: Long('10'),
      executionTimeMillisEstimate: Long('29')
    },
    {
      '$_internalSearchIdLookup': {
        limit: Long('10'),
        subPipeline: [
          { '$match': { _id: { '$eq': '_id placeholder' } } }
        ],
        totalDocsExamined: Long('10'),
        totalKeysExamined: Long('10'),
        numDocsFilteredByIdLookup: Long('0')
      },
      nReturned: Long('10'),
      executionTimeMillisEstimate: Long('30')
    }
  ],
  queryShapeHash: '2E39BED257F2B59D3F8652E1A81A18B1140602C4E253DED9FE208D584EA00083',
  serverInfo: {
    host: '<hostname>.mongodb.net',
    port: 27017,
    version: '8.2.1-rc1',
    gitVersion: '3312bdcf28aa65f5930005e21c2cb130f648b8c3'
  },
  serverParameters: {
    internalQueryFacetBufferSizeBytes: 104857600,
    internalQueryFacetMaxOutputDocSizeBytes: 104857600,
    internalLookupStageIntermediateDocumentMaxSizeBytes: 104857600,
    internalDocumentSourceGroupMaxMemoryBytes: 104857600,
    internalQueryMaxBlockingSortMemoryUsageBytes: 104857600,
    internalQueryProhibitBlockingMergeOnMongoS: 0,
    internalQueryMaxAddToSetBytes: 104857600,
    internalDocumentSourceSetWindowFieldsMaxMemoryBytes: 104857600,
    internalQueryFrameworkControl: 'trySbeRestricted',
    internalQueryPlannerIgnoreIndexWithCollationForRegex: 1
  },
  command: {
    aggregate: 'embedded_movies',
    pipeline: [
      {
        '$vectorSearch': {
          index: 'vector_index',
          path: 'plot_embedding_voyage_3_large',
          queryVector: [
            -0.034731735,  0.008558298,   -0.0153717, -0.029912498,  0.011549547,
            ...,
            -0.006688767,  0.047527634,  0.040714234
          ],
          numCandidates: 150,
          limit: 10
        }
      }
    ],
    cursor: {},
    '$db': 'sample_mflix'
  },
  ok: 1,
  '$clusterTime': {
    clusterTime: Timestamp({ t: 1759342175, i: 1 }),
    signature: {
      hash: Binary.createFromBase64('AZZrjVPfyyBofyQq/gzs9UBL+/Q=', 0),
      keyId: Long('7553982574624768005')
    }
  },
  operationTime: Timestamp({ t: 1759342175, i: 1 })
}

```
