Algolia icon

Algolia

Use Algolia in your n8n workflows

Overview

The "Search single index" operation in this Algolia node allows you to perform a search query on a single Algolia index and retrieve matching records (hits). This operation is useful when you want to fetch search results from a specific index with fine-grained control over the search parameters.

Common scenarios include:

  • Searching a product catalog for items matching user queries.
  • Filtering content based on facets, tags, or numeric filters.
  • Implementing geo-based searches by specifying location parameters.
  • Customizing search behavior with advanced options like typo tolerance, synonyms, personalization, and ranking.

Practical examples:

  • Retrieve the top 10 products matching the keyword "laptop" with facet filtering on brand and price range.
  • Search for nearby restaurants within a 5km radius of a given latitude/longitude.
  • Perform a broad search using a similar query parameter combined with filters to narrow down results.

Properties

Name Meaning
Index Name The name of the Algolia index to search.
Selector Choose how to provide search parameters: as a URL-encoded query string or as an object with individual parameters.
Params Search parameters as a URL-encoded query string (used if selector is "Search parameters as query string").
Search parameters as object Select which search parameters to include when providing them as an object. Options include Query, Filters, Facet Filters, Numeric Filters, Tag Filters, Pagination, Geo-search parameters, Ranking, Highlighting, etc.
Query The main search query string.
Similar Query Keywords used instead of the main query to conduct a broader search; changes some search settings accordingly.
Filters Filter expression to restrict results based on attributes, numeric ranges, tags, or boolean values.
Facet Filters Filters applied on facets, can be provided as array or string.
Optional Filters Filters that are optional, can be provided as array or string.
Numeric Filters Numeric filters to apply, can be provided as array or string.
Tag Filters Tag filters to apply, can be provided as array or string.
Sum Or Filters Scores Boolean indicating whether to sum all filter scores or keep the maximum.
Restrict Searchable Attributes JSON array restricting search to specified searchable attributes.
Facets JSON array of facets for which to retrieve facet values and counts.
Faceting After Distinct Boolean indicating whether faceting should be applied after deduplication with distinct.
Page Page number of search results to retrieve (pagination).
Offset Position of the first hit to retrieve.
Length Number of hits to retrieve (used with offset).
Around Lat Lng Latitude and longitude coordinates for geo-based search center.
Around Lat Lng Via IP Boolean to obtain coordinates from request's IP address.
Around Radius Maximum search radius around the central location in meters or "all" to return all records with valid geolocation.
Around Precision Distance in meters to group results by similar distances; can be integer or range objects.
Minimum Around Radius Minimum radius for geo search when aroundRadius isn't set.
Inside Bounding Box Coordinates defining rectangular areas to restrict search. Can be string, null, or array.
Inside Polygon Coordinates defining polygonal areas to restrict search. Ignored if insideBoundingBox is set.
Natural Languages ISO language codes adjusting settings for natural language processing.
Rule Contexts Strings to trigger matching rules in search.
Personalization Impact Numeric value indicating impact of personalization on ranking.
User Token Unique pseudonymous or anonymous user identifier for analytics and event tracking.
Get Ranking Info Boolean to include detailed ranking information in response.
Synonyms Boolean to consider index synonyms during search.
Click Analytics Boolean to include queryID attribute for click and conversion event tracking.
Analytics Boolean to include this search in analytics.
Analytics Tags JSON array of tags for segmenting analytics data.
Percentile Computation Boolean to include this search in processing-time percentile calculations.
Enable ABTest Boolean to enable A/B testing for this search.
Attributes To Retrieve JSON array of attributes to include in API response.
Ranking JSON array determining order of returned results based on ranking criteria.
Relevancy Strictness Numeric threshold below which less relevant results are excluded (only for virtual replica indices).
Attributes To Highlight JSON array of attributes to highlight in results.
Attributes To Snippet JSON array of attributes for which to enable snippets.
Highlight Pre Tag HTML tag inserted before highlighted parts.
Highlight Post Tag HTML tag inserted after highlighted parts.
Snippet Ellipsis Text String used as ellipsis indicator when snippet is truncated.
Restrict Highlight And Snippet Arrays Boolean to restrict highlighting/snippeting to items partially matched by query.
Hits Per Page Number of hits per page.
Min Word Sizefor1Typo Minimum characters in a word to accept matches with one typo.
Min Word Sizefor2Typos Minimum characters in a word to accept matches with two typos.
Typo Tolerance Typo tolerance setting; can be boolean or specific modes ("min", "strict", etc.).
Allow Typos On Numeric Tokens Boolean to allow typos on numbers in query.
Disable Typo Tolerance On Attributes JSON array of attributes for which typo tolerance is disabled.
Ignore Plurals Setting to ignore plurals; can be boolean, string, or array of languages.
Remove Stop Words Setting to remove stop words; can be boolean, string, or array of languages.
Query Languages JSON array of languages for language-specific query processing.
Decompound Query Boolean to split compound words into building blocks.
Enable Rules Boolean to enable rules in search.
Enable Personalization Boolean to enable personalization.
Query Type Determines prefix interpretation of query words ("prefixLast", "prefixAll", "prefixNone").
Remove Words If No Results Strategy for removing words from query if no results found ("none", "lastWords", "firstWords", "allOptional").
Mode Search mode ("keywordSearch" or "neuralSearch").
Semantic Search Settings for semantic search part of NeuralSearch, including event sources.
Advanced Syntax Boolean to support phrase matching and excluding words.
Optional Words List of optional words for the query.
Disable Exact On Attributes JSON array of attributes to turn off exact ranking criterion.
Exact On Single Word Query Determines exact ranking criterion computation for single-word queries ("attribute", "none", "word").
Alternatives As Exact JSON array determining which plurals and synonyms are considered exact matches.
Advanced Syntax Features JSON array of advanced syntax features supported ("exactPhrase", "excludeWords").
Distinct Controls deduplication of results; can be boolean or integer.
Replace Synonyms In Highlight Boolean to replace highlighted words with matched synonyms.
Min Proximity Minimum proximity score for two matching words.
Response Fields JSON array of properties to include in API response.
Max Values Per Facet Maximum number of facet values to return per facet.
Sort Facet Values By Order to retrieve facet values ("count" or "alpha").
Attribute Criteria Computed By Min Proximity Boolean to determine best matching attribute by minimum proximity.
Rendering Content Extra data for search UI control, including facet ordering, redirects, and widgets.
Enable Re Ranking Boolean to enable Dynamic Re-Ranking if activated in Algolia dashboard.
Re Ranking Apply Filter Filter applied when re-ranking is enabled; can be array, string, or null.

Output

The output contains a JSON field with the search results returned by Algolia. This includes:

  • hits: An array of matching records with their attributes.
  • Metadata such as nbHits (number of hits), page, hitsPerPage, processingTimeMS, and others depending on the request parameters.
  • If enabled, detailed ranking info, query IDs, analytics data, and facet counts.
  • The structure follows Algolia's standard search response format.

If binary data were involved (not applicable here), it would be summarized accordingly.

Dependencies

  • Requires an Algolia account with appropriate API credentials (API key and Application ID).
  • The node uses these credentials to authenticate requests to Algolia's REST API.
  • Network access to Algolia's API endpoints is necessary.
  • No additional external dependencies beyond the Algolia API and n8n environment.

Troubleshooting

  • Invalid Index Name: Ensure the specified index exists in your Algolia application.
  • Authentication Errors: Verify that the API key and Application ID credentials are correctly configured and have sufficient permissions.
  • Malformed Filters or Parameters: Use correct syntax for filters, facets, and other parameters as per Algolia documentation.
  • Rate Limits: Algolia enforces rate limits; excessive requests may result in errors.
  • Empty Results: Check query and filters; consider adjusting typo tolerance or removing restrictive filters.
  • Large Queries: Some parameters have size limits (e.g., 512 bytes for each parameter value); exceeding these may cause errors.
  • Geo Search Parameters: Ensure coordinates and radius values are valid and consistent.
  • Advanced Features: Enabling features like personalization or dynamic re-ranking requires prior setup in Algolia dashboard.

Links and References

Discussion