API Reference
API wrapper documentation for the BoxLang Meilisearch module.
Indexes
List indexes
List all indexes with pagination and filtering options.
var result = meilisearch()
.indexes()
.list();Swap indexes
Swap two indexes for zero-downtime deployments.
meilisearch()
.indexes()
.swap( [ "books", "books_staging" ] );Get stats
Get database and index statistics including document counts and sizes.
Single Index
Get an index
Retrieve a single index by its unique identifier.
Create an index
Create a new index with an optional primary key.
Get Index stats
Get index statistics.
Compact an index
Compact an index to reduce database fragmentation.
Delete an index
Permanently delete an index and all its documents.
Documents
Add or Replace Documents
Add or replace documents in an index. Replaces existing documents with the same primary key.
Add or Update Documents
Add or update documents in an index. Updates existing documents instead of replacing them entirely.
Delete All Documents
Delete all documents from an index.
Get Documents
Retrieve documents from an index with optional filtering.
Get Single Document
Retrieve a specific document by its ID.
Delete Single Document
Delete a specific document by its ID.
Search
The Search DSL provides a fluent interface for querying documents in an index. It supports both POST (default) and GET request methods.
Basic search
Search for documents using a query string.
Search with parameters
Pass initial parameters as the second argument to search().
Fluent DSL with chained methods
Chain parameter methods for a readable, builder-style interface.
Any Meilisearch search parameter can be used as a method call. The method name becomes the parameter name, and the method value becomes the parameter value.
Common parameters:
filter- Filter results using Meilisearch filter expressionslimit- Maximum number of results to returnoffset- Number of results to skip (for pagination)attributesToRetrieve- Comma-separated list of fields to returnsort- Sort order (e.g., "price:asc")facets- Facets to compute
Search with GET request
Use sendWithGet() instead of send() to make a GET request instead of POST.
Facets
The Facets API allows you to search for facet values using AI-powered prefix search and typo tolerance.
Note: This endpoint requires attributes to be added to filterableAttributes in index settings first.
Facet search
Search for facet values within a given facet.
Keys
List API keys
List all API keys with optional pagination.
Get an API key
Retrieve a single API key by its UID or key value.
🔗 Meilisearch: Get Key
Update an API key
Update an existing API key's name or description.
Delete an API key
Permanently delete an API key.
Settings
List settings
Retrieve the complete settings configuration for an index.
Update settings
Update index settings including ranking rules, searchable attributes, and more.
Reset settings
Reset all index settings to their default values.
Tasks
List tasks
List all asynchronous tasks with filtering and pagination options.
Get a task
Retrieve a single task by its unique identifier.
Cancel tasks
Cancel enqueued or processing tasks.
Delete tasks
Delete tasks matching specific criteria.
Batches
The Batches API allows you to monitor how Meilisearch groups and processes asynchronous operations. Batches show the progress of grouped tasks.
List batches
List all batches with filtering and pagination options.
Get a batch
Retrieve a single batch by its unique identifier.
Webhooks
The Webhooks API allows you to trigger automatic workflows when Meilisearch finishes processing tasks. When a task completes, Meilisearch sends the task object to all configured webhooks.
Note: You can create up to 20 webhooks. Having multiple webhooks active at the same time may negatively impact performance.
List webhooks
List all configured webhooks.
Create a webhook
Create a new webhook to receive task completion notifications.
Get a webhook
Retrieve a single webhook by its UUID.
Update a webhook
Update a webhook's configuration. To remove a field, set its value to null.
Delete a webhook
Delete a webhook to stop receiving task completion notifications.
Task Object
Every asynchronous operation in Meilisearch (index creation, document updates, index swaps, etc.) returns a Task object. This object provides methods to track the operation's progress and wait for completion.
Understanding Tasks
Meilisearch operations are asynchronous - when you create an index or add documents, Meilisearch creates a Task to track that operation while it continues in the background. You use the Task object to:
Check the current status of the operation
Wait for the operation to complete
Get detailed information about the operation result
Example: Creating an Index with Task Tracking
Task.getStatus()
Get the current status of the task.
Possible values:
enqueued- Task is in the queue, waiting to be processedprocessing- Task is currently being processedsucceeded- Task completed successfullyfailed- Task failed (checkgetError()for details)canceled- Task was canceled
Task.getType()
Get the type of operation this task represents.
Common types:
indexCreation- Creating a new indexindexUpdate- Updating an indexindexDeletion- Deleting an indexdocumentAdditionOrUpdate- Adding or updating documentsdocumentDeletion- Deleting documentsindexSwap- Swapping two indexessettingsUpdate- Updating index settings
Task.toStruct()
Convert the Task object to a plain struct with all task data.
Task.waitForCompletion( interval )
Wait for the task to complete by polling at regular intervals.
Parameters:
interval(integer) - Number of milliseconds to wait between polls (default: 1000)timeout(integer) - Maximum time to wait for task completion in milliseconds (default: 30000)
Returns: A new Task object with the final task status
Note: The original Task object is not modified; waitForCompletion() returns a new Task instance with updated data.
Additional Task Getters
Experimental Features
List experimental features
List all available experimental features and their current status.
Get an experimental feature
Retrieve the status of a specific experimental feature.
Enable/disable an experimental feature
Enable or disable a specific experimental feature.
Set multiple experimental features
Enable or disable multiple experimental features at once.
Snapshots
Create a snapshot
Create a snapshot of the Meilisearch instance for backup purposes.
Network
The Network API allows you to create a network of Meilisearch instances for federated search and horizontal database partitioning strategies like sharding.
Note: This is an experimental feature. Enable it first using the experimental features endpoint.
Get network configuration
Retrieve the current network configuration including self instance name, sharding status, and remote instances.
Update network configuration
Update the network configuration. Updates are partial - only provide the fields you want to update.
Similar Documents
The Similar Documents API uses AI-powered search to find documents similar to a specific document. This requires the document to have vector embeddings generated by a configured embedder.
Note: This endpoint requires an embedder to be configured in the index settings first.
Get similar documents
Find documents similar to a target document using POST or GET requests.
Health Check
Check instance health
Check if the Meilisearch instance is available and responding.
🔗 Meilisearch: Health
Version
Get instance version
Retrieve the version information of the Meilisearch instance.
🔗 Meilisearch: Version
Last updated
Was this helpful?
