Meilisearch icon

Meilisearch

Consume Meilisearch API

Overview

The Meilisearch node for n8n allows you to interact with a Meilisearch instance. Specifically, the Documents resource with the Add or Update Documents operation enables you to add new documents or update existing ones in a specified index within your Meilisearch database. This is useful for keeping your search indexes up-to-date with the latest data from your workflows.

Common scenarios:

  • Bulk importing or updating product listings in an e-commerce search index.
  • Synchronizing user profiles or content items into a search engine for fast retrieval.
  • Automating updates to searchable datasets as part of a data pipeline.

Example:
You have a list of new blog posts and want to make them searchable on your website. You can use this node to push all new or updated posts into your Meilisearch index.


Properties

Name Meaning
Index UID The name (UID) of the Meilisearch index where documents will be added or updated. You select from available indexes; each option shows the index UID and its primary key.
Documents JSON The JSON object(s) representing the documents to add or update. Must be valid JSON. You can use expressions like {{ JSON.stringify($json) }} or {{ JSON.stringify($jmespath($input.all(), "[] .json")) }} for input.

Output

  • The output will contain a json field with the response from the Meilisearch API after attempting to add or update the documents.
  • The structure typically includes information about the task created in Meilisearch, such as a task UID, status, and type.
  • Example output:
{
  "taskUid": 123,
  "indexUid": "my_index",
  "status": "enqueued",
  "type": "documentAdditionOrUpdate"
}
  • Note: This node does not output binary data.

Dependencies

  • External Service: Requires access to a running Meilisearch instance.
  • API Key: Needs a valid Meilisearch API key configured in n8n credentials (meilisearchApi).
  • Environment Variable: The base URL for Meilisearch must be set in the credentials as host_url.

Troubleshooting

Common issues:

  • Invalid JSON: If the Documents JSON property contains invalid JSON, the node will throw a parsing error. Ensure your input is properly formatted.
  • Missing Index: If the specified Index UID does not exist, Meilisearch will return an error. Double-check the selected index.
  • Authentication errors: If the API key is missing or incorrect, you'll receive authentication/authorization errors from Meilisearch.
  • Payload too large: Very large document batches may exceed server limits.

Error messages and resolutions:

  • "Invalid JSON": Check your Documents JSON input for syntax errors.
  • "Index not found": Make sure the index exists in your Meilisearch instance.
  • "401 Unauthorized": Verify your API key and host URL in the credentials.

Links and References

Discussion