$listSearchIndexes
New from version 8.0.1.
The $listSearchIndexes aggregation stage in Amazon DocumentDB returns information about existing search indexes on a collection. It must be the first stage in an aggregation pipeline.
Parameters
-
name: (optional) The name of the search index to return information about. If omitted, all search indexes on the collection are returned.
Output fields
Each returned document contains the following fields:
-
name: The name of the search index. -
status: The build state of the index. One ofREADY(built and valid),BUILDING(a concurrent build is in progress), orFAILED(the index build did not complete successfully). -
queryable: A boolean indicating whether the index can currently be used to serve queries. This isfalsefor hidden indexes (which remainREADY) and forFAILEDindexes. A hidden index is the case wherestatusisREADYbutqueryableisfalse. -
latestDefinitionVersion: A document containingversion(the index format version) andcreatedAt(the time the index was created).
Syntax
db.collection.aggregate([ { $listSearchIndexes: {} } ]) // Or filter by name: db.collection.aggregate([ { $listSearchIndexes: { name: "mySearchIndex" } } ])
Example (MongoDB Shell)
The following example demonstrates how to use the $listSearchIndexes stage to list all search indexes on a collection.
Query example
db.movies.aggregate([ { $listSearchIndexes: {} } ]);
Output
[
{
"name": "default",
"status": "READY",
"queryable": true,
"latestDefinitionVersion": {
"version": 2,
"createdAt": ISODate("2026-05-11T21:12:57.974Z")
}
}
]
A hidden index remains READY but reports queryable: false, because it cannot be used to serve queries while hidden:
[
{
"name": "myHiddenIndex",
"status": "READY",
"queryable": false,
"latestDefinitionVersion": {
"version": 2,
"createdAt": ISODate("2026-05-11T21:12:57.974Z")
}
}
]
To filter by a specific index name:
db.movies.aggregate([ { $listSearchIndexes: { name: "default" } } ]);
Code examples
To view a code example for using the $listSearchIndexes stage, choose the tab for the language that you want to use: