Actions12
- Search Index Actions
- Document Actions
Search Index → Create
AI-generatedSummary
Create a MongoDB search index
Inputs
- collection (required) — MongoDB Collection
- indexNameRequired (required) — The name of the search index
- indexDefinition (required) — The search index definition
- indexType (required) — The search index index type
Output shape
an array of objects each containing the created index name
On success each item returns
{indexName: <name>}; with continueOnFail errors are returned as{error: message}
Examples
Example 1: Create a vector search index on the 'posts' collection
Collection: posts, Index Name: posts_vector, Index Definition: {"type":"vectorSearch","definition":{}}, Index Type: vectorSearch
Example 2: Create a text search index on the 'users' collection
Collection: users, Index Name: users_text, Index Definition: {"type":"search","definition":{}}, Index Type: search