Meilisearch¶
Index events as searchable documents in Meilisearch.
Docker Image¶
Configuration¶
With Authentication¶
Options¶
| Option | Type | Required | Default | Metadata Override | Description |
|---|---|---|---|---|---|
url |
string | Yes | - | No | Meilisearch URL |
index |
string | No | - | Yes | Default index (can be overridden per-event) |
api_key |
string | No | - | No | API key for authentication |
Dynamic Routing¶
Route events to different indexes using metadata:
-- Route by table name
metadata_extensions = '[
{"json_path": "index", "expression": "tg_table_name"}
]'
-- Or use static metadata
metadata = '{"index": "products"}'
The sink reads index from event metadata.
Primary Key¶
Meilisearch requires each document to have a primary key. Options:
- Configure in Meilisearch: Set the primary key field when creating the index
- Add via payload_extensions: Transform the event ID into the expected field
-- Add id field from event
payload_extensions = '[
{"json_path": "id", "expression": "new.id::text"}
]'
Document Format¶
The event payload is indexed directly (not the full envelope). Your payload structure should match your Meilisearch schema.
Task Handling¶
The sink waits for indexing tasks to complete before returning success. This ensures data consistency but may impact throughput for large batches.
Example¶
Complete configuration:
stream:
id: 1
pg_connection:
host: localhost
port: 5432
name: mydb
username: postgres
password: postgres
tls:
enabled: false
batch:
max_size: 1000
max_fill_secs: 5
sink:
type: meilisearch
url: http://localhost:7700
index: products
api_key: masterKey
Index Setup¶
Create an index with appropriate settings: