This is the reference for the Meilisearch sink. See the quickstart for a step-by-step walkthrough or the how-to guide for an explanation of how to use the Meilisearch sink.
Configuration
-
Endpoint URL
The URL of your Meilisearch server (e.g.,
http://localhost:7700
orhttps://your-meilisearch-instance.com
). - Index name The name of the Meilisearch index where documents will be indexed. The index must exist before imports can work.
-
Primary key
The primary key field for the Meilisearch index. (By default, this is
id
) - API key The API key for authenticating with your Meilisearch server.
Transform requirements
Your transform must return a document matching the schema of the Meilisearch index. For example, the following transform ensures the primary key (id
) is at the top level of the returned map:
Import action
Sequin uses Meilisearch’s documents API to create or update documents:- Meilisearch will create a new document or update an existing one based on the
id
.
API endpoints used by Sequin
Sequin uses the following endpoints of the Meilisearch Documents API:-
POST /indexes/{index_uid}/documents
For indexing batches of documents or single documents. Meilisearch accepts both. -
POST /indexes/{index_uid}/documents/delete-batch
For batch deleting documents. -
GET /tasks/{task_uid}
For checking the status of asynchronous tasks.
GET /indexes/{index_uid}
Only called when you click “Test Connection” in the Sequin console.
Successful responses indicate the connection is working and the index exists, but the result is otherwise ignored.
Routing
The Meilisearch sink supports dynamic routing of theaction
and index_name
with routing functions.
Routing Actions
The Meilisearch sink supports three actions:index
- Create or update a documentdelete
- Delete a documentfunction
- Apply a function-based update using Meilisearch’s documents edit API
Basic Example
Function Updates
Thefunction
action allows you to update documents using Meilisearch’s function expressions. This is useful for:
- Incrementing/decrementing values
- Modifying arrays
- Conditional updates
- Complex transformations that would be difficult with regular indexing
action: "function"
, you must also provide:
filter
- A Meilisearch filter expression to select documents to updatefunction
- A function expression using Rhai (a JavaScript-like language) to apply to the matched documentscontext
(optional) - Additional context data for the function
Error handling
Common errors that can occur when working with the Meilisearch sink include:- Connection issues to the Meilisearch server (HTTP vs HTTPS, TCP port, URL typos, etc.)
- Schema mismatches
- Missing primary key fields
Error messages from the Meilisearch API are passed through unchanged to the Sequin console, including messages for asynchronous batch imports.