Meilisearch icon

Meilisearch

Consume Meilisearch API

Overview

The Meilisearch node for n8n allows you to interact with the Meilisearch API. Specifically, the Indexes → Create Index operation enables users to create a new index in their Meilisearch instance. This is useful when you want to organize and store documents under a specific collection (index) for efficient searching and retrieval.

Common scenarios:

  • Setting up a new searchable dataset in Meilisearch.
  • Preparing your Meilisearch instance to receive documents for a new type of data (e.g., products, articles).
  • Automating the creation of indexes as part of a workflow that provisions search infrastructure dynamically.

Practical example:
Suppose you are building an e-commerce platform and want to enable fast product searches. You can use this node to create a "products" index with a unique primary key before importing your product catalog.


Properties

Name Meaning
UID Name of the index. This is a unique identifier for the index within Meilisearch.
Primary Key Unique attribute of the index. This field specifies which document property will act as the primary key.

Output

The node outputs a JSON object representing the newly created index. The structure typically includes:

{
  "uid": "string",           // The name/identifier of the index
  "primaryKey": "string",    // The primary key attribute for the index
  "createdAt": "string",     // Timestamp of index creation
  "updatedAt": "string"      // Timestamp of last update
}

Note: Actual output fields may vary depending on the Meilisearch API version.


Dependencies

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

Troubleshooting

Common issues:

  • Invalid or missing credentials: Ensure the Meilisearch API key and host URL are correctly configured in n8n.
  • Index already exists: Attempting to create an index with a UID that already exists will result in an error.
  • Missing required fields: Both UID and Primary Key are required; omitting them will cause the operation to fail.
  • Network errors: If n8n cannot reach the Meilisearch server, check network connectivity and firewall settings.

Error messages and resolutions:

  • "Index already exists": Choose a different UID or delete the existing index first.
  • "Primary key is invalid": Ensure the primary key matches a field present in your documents.
  • "Unauthorized": Check your API key permissions.

Links and References

Discussion