Algolia icon

Algolia

Use Algolia in your n8n workflows

Actions3

Overview

The "Search Index" operation of the Index resource in this custom n8n Algolia node allows you to search for objects within a specified Algolia index using a query string and optional advanced search parameters. This is useful for retrieving data that matches specific criteria from your Algolia indices directly within an n8n workflow.

Common scenarios:

  • Searching for user profiles, products, or documents stored in Algolia based on keywords.
  • Filtering and paginating large datasets in automated workflows.
  • Integrating Algolia-powered search results into notification, reporting, or enrichment processes.

Practical example:
You could use this node to search for all products containing the word "laptop" in their description, retrieve only certain fields (like name and price), and process the results further in your workflow.


Properties

Name Type Meaning
Index Name options The Algolia index to search in. Populated dynamically with available indices from your Algolia account.
Query string The text used to search the index.
Simplify boolean Whether to return a simplified version of the response (just the hits) instead of the full raw data.
Search Parameters collection Additional search parameters:
- attributesToRetrieve string[] List of attribute names to include in the result.
- hitsPerPage number Number of results per page (default: 20, min: 0, max: 1000).
- page number Page number to retrieve (default: 0, min: 0).

Output

  • If Simplify is enabled:
    The output will be an array of objects representing the hits returned by Algolia. Each object corresponds to a matching record in the index, containing only the fields requested (or all fields if none specified).

    [
      {
        "objectID": "123",
        "name": "Example",
        "price": 99.99,
        // ...other fields as per attributesToRetrieve
      },
      ...
    ]
    
  • If Simplify is disabled:
    The output will contain the full Algolia search response, including metadata such as nbHits, page, hitsPerPage, etc.

    [
      {
        "hits": [ ... ],
        "nbHits": 42,
        "page": 0,
        "hitsPerPage": 20,
        // ...other Algolia response fields
      }
    ]
    
  • Binary Data:
    This node does not output binary data.


Dependencies

  • External Service: Requires access to an Algolia account and at least one configured index.
  • API Key: You must provide valid Algolia credentials (appId and apiKey) via n8n's credential system.
  • n8n Configuration: No special environment variables are required beyond standard credential setup.

Troubleshooting

Common issues:

  • Invalid Credentials:
    Error messages about authentication failures indicate incorrect or missing Algolia API keys or App ID. Double-check your credentials in n8n.

  • Index Not Found:
    If the selected index does not exist or is misspelled, Algolia will return an error. Ensure the "Index Name" property matches an existing index.

  • Query Returns No Results:
    If your query is too restrictive or the index is empty, you may receive an empty hits array.

  • Parameter Errors:
    Supplying invalid values for hitsPerPage or page (e.g., negative numbers, exceeding limits) can cause errors. Stay within documented ranges.

Error resolution:

  • Check the error message details in n8n's execution log.
  • Verify all input properties, especially dynamic options like "Index Name".
  • Confirm your Algolia account has the necessary permissions for the operation.

Links and References

Discussion