Algolia icon

Algolia

Use Algolia in your n8n workflows

Overview

The "Save object" operation in the Records resource allows you to add or replace a single record in an Algolia index. If the record does not have an object ID, Algolia will generate one automatically. If a record with the specified object ID exists, it will be replaced; otherwise, a new record is added. Additionally, if the target index does not exist, it will be created automatically.

This operation is useful for managing individual records in your search indices, such as adding new products, updating user profiles, or replacing existing entries. It is ideal when you want to handle one record at a time rather than batch operations.

Practical examples:

  • Adding a new product to your e-commerce search index.
  • Updating the details of a user profile in a customer database.
  • Replacing outdated content in a documentation search index.

Properties

Name Meaning
Index Name The name of the Algolia index where the record will be saved. This is required.

Output

The node outputs the JSON response from the Algolia API after saving the object. This typically includes information about the indexing task, such as task IDs and status, confirming that the record was successfully added or updated.

If the operation supports binary data (not indicated here), it would represent the binary content associated with the record, but this operation deals with JSON objects only.

Dependencies

  • Requires an Algolia account and an API key credential configured in n8n for authentication.
  • The node uses the Algolia REST API endpoint POST /1/indexes/{indexName} to save the object.
  • The base URL for requests is constructed using the Algolia application ID from credentials.
  • Proper API permissions are necessary to perform indexing operations.

Troubleshooting

  • Common issues:

    • Missing or incorrect API credentials can cause authentication failures.
    • Providing an invalid or empty index name will result in errors.
    • Exceeding Algolia's indexing rate limits may cause request throttling or errors.
    • Malformed record data (e.g., invalid JSON) can lead to request rejection.
  • Error messages and resolutions:

    • Authentication error: Verify that the API key credential is correctly set up and has the required permissions.
    • Index not found: The node creates the index if it doesn't exist, but ensure the index name is valid.
    • Rate limit exceeded: Reduce the frequency of requests or upgrade your Algolia plan.
    • Invalid object ID or record format: Ensure the record data is properly formatted JSON and the object ID (if provided) is valid.

Links and References

Discussion