Meilisearch icon

Meilisearch

Consume Meilisearch API

Overview

The node integrates with the Meilisearch API, specifically enabling operations on search indexes. The "Search Index" operation allows users to perform full-text searches within a specified index. This is useful for applications that require fast and relevant search capabilities over large datasets, such as e-commerce product catalogs, document repositories, or media libraries.

Typical use cases include:

  • Searching a product database by keywords, filters, and facets.
  • Retrieving paginated search results with highlighted matching terms.
  • Applying complex filters and sorting to refine search output.

For example, a user can query a movie index to find all horror or mystery genres directed by a specific director, retrieve only certain attributes, and highlight matched terms in the results.

Properties

Name Meaning
UID Name of the index to search within. Must be selected from available indexes.
Additional Fields A collection of optional parameters to customize the search query:
- Search Query The main query string to search for (e.g., keywords).
- Offset Number of results to skip before starting to collect the result set (for pagination). Minimum 1.
- Limit Maximum number of results to return. Minimum 1. Default is 50.
- Hits Per Page Maximum number of results per page. Minimum 1. Default is 50.
- Page Specific page number of results to request. Minimum 1.
- Filter String Filter expression to narrow down results, e.g., (genres = horror OR genres = mystery) AND director = 'Jordan Peele'.
- Facets String Comma-separated list of facets to display counts for; use * to get all facets.
- Attributes To Retrieve Comma-separated list of attributes to include in returned documents.
- Attributes To Crop Comma-separated list of attributes whose values should be cropped (shortened).
- Crop Length Maximum length (in words) for cropped attribute values. Minimum 1.
- Crop Marker String used to mark boundaries of cropped text.
- Attributes To Highlight Comma-separated list of attributes where matching terms should be highlighted.
- Highlight Pre Tag String inserted at the start of a highlighted term. Defaults to <em>.
- Highlight Post Tag String inserted at the end of a highlighted term. Defaults to </em>.
- Show Ranking Score Boolean flag indicating whether to include the ranking score in the results.
- Show Matches Position Boolean flag indicating whether to include the location of matching terms in the results.
- Sort Comma-separated list of attributes and directions to sort by, e.g., price:asc,release_date:desc.
- Matching Strategy Strategy for matching query terms within documents. Options are last (default) or all.

Output

The node outputs JSON data representing the search results returned by Meilisearch. The structure typically includes:

  • An array of matched documents with requested attributes.
  • Pagination information such as total hits, offset, limit, and page.
  • Optional metadata like ranking scores and match positions if enabled.
  • Facet counts if requested.

If binary data were supported, it would represent associated files or attachments, but this node focuses on JSON search results only.

Dependencies

  • Requires an active Meilisearch instance accessible via a base URL.
  • Needs an API key credential configured in n8n for authentication.
  • The node sends HTTP requests with JSON payloads to the Meilisearch REST API.

Troubleshooting

  • Invalid UID: If the specified index name does not exist, the node will fail. Ensure the index is created and the UID matches exactly.
  • Authentication errors: Missing or incorrect API key credentials will cause authorization failures.
  • Malformed filter or query strings: Syntax errors in filter expressions or queries may lead to API errors. Validate expressions carefully.
  • Pagination issues: Setting offset, limit, or page to invalid values (e.g., less than 1) may cause errors or unexpected results.
  • Empty results: Could indicate no matches or incorrect query/filter parameters.
  • Sorting errors: Incorrectly formatted sort strings may be rejected by the API.

To resolve errors, verify credentials, check index existence, validate query syntax, and ensure numeric parameters meet minimum requirements.

Links and References

Discussion