Actions24
- Documents Actions
- Indexes Actions
- Keys Actions
- Search Actions
- Settings Actions
- Tasks Actions
Overview
The Meilisearch node's "Search" resource with the "Search Index" operation allows you to perform advanced search queries on a specified Meilisearch index. This is useful for retrieving documents that match complex criteria, filtering, faceting, sorting, and customizing which fields are returned or highlighted. Common scenarios include building search features for web applications, filtering product catalogs, or implementing full-text search in content management systems.
Practical examples:
- Searching a movie database for horror films directed by a specific person.
- Retrieving paginated and sorted results from a product catalog.
- Highlighting matching terms in search results for a user-facing search bar.
Properties
| Name | Meaning |
|---|---|
| UID | Name of the index to search within. (Required) |
| Additional Fields | Collection of optional parameters to refine your search. Includes: |
| - Search Query | The query string to search for. |
| - Offset | Number of results to skip (for pagination). |
| - Limit | Maximum number of results to return. |
| - Hits Per Page | Maximum number of results per page. |
| - Page | Specific page of results to request. |
| - Filter String | Query string to filter results, e.g., (genres = horror OR genres = mystery) AND director = 'Jordan Peele'. |
| - Facets String | Comma-separated list of facets to display counts for; use * for all facets. |
| - Attributes To Retrieve | Comma-separated list of document attributes to include in results. |
| - Attributes To Crop | Comma-separated list of attributes whose values should be cropped. |
| - Crop Length | Maximum length (in words) for cropped attribute values. |
| - Crop Marker | String used to mark crop boundaries. |
| - Attributes To Highlight | Comma-separated list of attributes where matching terms will be highlighted. |
| - Highlight Pre Tag | String inserted at the start of a highlighted term (default: <em>). |
| - Highlight Post Tag | String inserted at the end of a highlighted term (default: </em>). |
| - Show Matches Position | Boolean; whether to return the location of matching terms. |
| - Sort | Comma-separated list of attributes and sort directions, e.g., price:asc,release_date:desc. |
| - Matching Strategy | Strategy for matching query terms: Last or All. |
Output
- The output is a JSON object containing the search results as returned by the Meilisearch API.
- Typical structure includes:
hits: Array of matched documents.offset,limit,nbHits,exhaustiveNbHits,processingTimeMs,query, etc.- If highlighting or cropping is enabled, additional fields such as
_formattedmay appear in each hit.
- No binary data is produced by this operation.
Example output:
{
"hits": [
{
"id": 1,
"title": "Get Out",
"_formatted": {
"title": "<em>Get</em> Out"
}
}
],
"offset": 0,
"limit": 20,
"nbHits": 1,
"exhaustiveNbHits": true,
"processingTimeMs": 2,
"query": "get out"
}
Dependencies
- External Service: Requires access to a running Meilisearch instance.
- API Key: Needs valid Meilisearch credentials configured in n8n (
meilisearchApi). - Environment Variable: The base URL for Meilisearch must be set in the credentials (
host_url).
Troubleshooting
- Invalid Index Name: If the provided UID does not exist, an error will occur. Double-check the index name.
- Authentication Errors: Missing or incorrect API key/host URL will result in authentication failures.
- Malformed Query: Incorrect syntax in filter or facet strings can cause errors. Refer to Meilisearch documentation for correct formats.
- Empty Results: If no documents match the query or filters, the
hitsarray will be empty.
Common error messages:
"Index not found": Ensure the UID matches an existing index."Invalid API key": Check your credentials."Bad request": Review your filter, facets, or other advanced parameters for typos or unsupported options.