Meilisearch icon

Meilisearch

Consume Meilisearch API

Overview

This node interacts with the Meilisearch API, specifically focusing on the "Indexes" resource and the "Get Stats of an Index" operation. It allows users to retrieve statistical information about a specific index in their Meilisearch instance. This is useful for monitoring index health, understanding document counts, and optimizing search performance.

Common scenarios:

  • Monitoring the number of documents in a particular index.
  • Checking the status or size of an index before performing bulk operations.
  • Integrating Meilisearch statistics into dashboards or automated workflows.

Practical example:
A user wants to trigger an alert if the number of documents in a product catalog index exceeds a certain threshold. They can use this node to fetch the stats and then use n8n logic to check the count.

Properties

Name Meaning
UID Name of the index. This is a required option field that lets you select from available indexes in your Meilisearch instance. The options are dynamically loaded from the /indexes endpoint and display both the UID and primary key of each index.

Output

The output will be a JSON object containing statistical information about the selected index. While the exact structure depends on the Meilisearch API, typical fields include:

{
  "numberOfDocuments": 12345,
  "isIndexing": false,
  "fieldDistribution": {
    "title": 12345,
    "description": 12000
  }
}
  • numberOfDocuments: Total number of documents in the index.
  • isIndexing: Boolean indicating if the index is currently being updated.
  • fieldDistribution: Object showing how many documents contain each field.

Note: The actual output may include additional fields depending on your Meilisearch version.

Dependencies

  • Meilisearch API: Requires access to a running Meilisearch instance.
  • API Key: You must configure the meilisearchApi credential in n8n, which should include the host URL and an appropriate API key.

Troubleshooting

  • Invalid UID: If the selected UID does not exist, the node will likely return an error such as "Index not found." Ensure the UID matches an existing index.
  • Authentication errors: If the API key is missing or incorrect, you may see errors like "Unauthorized" or "Invalid API key." Double-check your credentials.
  • Connection issues: Errors such as "Could not connect to Meilisearch" indicate network or configuration problems. Verify the host URL and network connectivity.

Links and References

Discussion