Meilisearch icon

Meilisearch

Consume Meilisearch API

Overview

The Delete Batch of Documents operation in the "Documents" resource for the Meilisearch n8n node allows users to delete multiple documents from a specified index in one request. This is particularly useful when you need to remove several records at once, such as cleaning up outdated data or bulk-managing your search index content.

Practical examples:

  • Removing a set of user profiles that have been deactivated.
  • Deleting products that are no longer available from an e-commerce catalog.
  • Cleaning up test or temporary data from a search index.

Properties

Name Meaning
Index UID Name of the index from which documents will be deleted. You can select from existing indexes.
UIDs JSON array of document IDs to delete. Enter the IDs of the documents you want to remove from the index.

Output

  • The output will contain the result of the batch deletion operation. Typically, this includes a JSON object with information about the deletion task, such as a task ID and status.
  • No binary data is produced by this operation.

Example output structure:

{
  "taskUid": 123,
  "indexUid": "products",
  "status": "enqueued",
  "type": "documentDeletion",
  "details": {
    "deletedDocumentIds": ["doc1", "doc2", "doc3"]
  },
  "enqueuedAt": "2024-06-01T12:34:56Z"
}

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 (credential type: meilisearchApi).
  • Environment Variable: The base URL for Meilisearch must be set in the credentials (host_url).

Troubleshooting

  • Invalid Index UID: If the specified index does not exist, the operation will fail. Ensure the "Index UID" matches an existing index.
  • Malformed UIDs Array: The "UIDs" property must be a valid JSON array of document IDs. Invalid JSON or non-existent IDs may cause errors.
  • Insufficient Permissions: The provided API key must have permission to delete documents. Otherwise, you may receive an authorization error.
  • Common Error Messages:
    • "Index not found": Check the "Index UID" value.
    • "Invalid document IDs": Ensure the "UIDs" field contains a valid JSON array of existing document IDs.
    • "Unauthorized": Verify your API key and permissions.

Links and References

Discussion