Meilisearch icon

Meilisearch

Consume Meilisearch API

Overview

The Meilisearch node for n8n allows you to interact with the Meilisearch API. Specifically, the "Get One Document" operation under the "Documents" resource retrieves a single document from a specified index using its unique identifier (Document ID). This is useful when you need to fetch detailed information about a specific record stored in your Meilisearch instance.

Common scenarios:

  • Fetching user profiles, product details, or any entity by its unique ID.
  • Integrating Meilisearch data into workflows for further processing or enrichment.
  • Displaying or exporting specific documents based on workflow logic.

Example:
Retrieve a product's full details from the "products" index using its unique product ID and only display selected fields such as name and price.


Properties

Name Meaning
Index UID Name of the index from which to retrieve the document. You select this from available indexes in your Meilisearch instance.
Document ID Unique identifier for the document you want to retrieve. This is required to fetch a specific document.
Fields Comma-separated list of fields to display for the API resource. By default, all fields are returned (*). You can specify particular fields (e.g., name,price) to limit the output to those fields only.

Output

  • The output will be a JSON object representing the requested document.
  • If the "Fields" property is used, only the specified fields will be included in the output; otherwise, all fields of the document are returned.
  • Example output:
{
  "id": "123",
  "name": "Sample Product",
  "price": 19.99
}
  • No binary data is produced by this operation.

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 Index UID: If the specified index does not exist, the node will return an error. Double-check the index selection.
  • Missing or Incorrect Document ID: If the document ID is missing or incorrect, no document will be found, and an error or empty result may be returned.
  • Insufficient Permissions: If the API key lacks permission to read documents, an authorization error will occur.
  • Malformed Fields Parameter: If the "Fields" value contains invalid field names or formatting, the API may return an error or omit those fields.

Error messages and resolutions:

  • "Index not found": Ensure the correct index is selected.
  • "Document not found": Verify the Document ID exists in the chosen index.
  • "Unauthorized": Check that the API key has sufficient permissions.

Links and References

Discussion