Integrations / commercetools

Configure commercetools sources for Algolia

To configure the commercetools connector:

  1. Configure your data source
  2. Configure your destination
  3. Configure your tasks

Configure your data source

A source defines how to authenticate with your commercetools project, and which store and languages you want to index.

In the Configure your data source form, paste the curl command from your commercetools API client. This automatically fills the form with details about your commercetools project and creates an authentication method.

commercetools curl input

If you want to enter custom information, manually fill the form.

commercetools source form

This form includes information about:

  • The OAuth 2.0 authentication so that Algolia can connect to your commercetools project.
  • The API URL and Project Key to identify which project to fetch.
  • The Store and Languages to index.
  • The Fallback stock value which determines which value is stored in the Algolia record if there is no inventory information on the product.

Select the commercetools store you want to index. Under Languages, select one or more product data languages for your store.

After filling the form, click Create source to set up the source.

Advanced settings

Product query predicate

The product query predicate is an optional filter that gets appended to the product-projection endpoint in commercetools’ API when fetching product information. Products returned by the commercetools API after applying this filter will be indexed. Your filter must follow commercetools recommendations and limitations. Examples:

  • variants(prices(value(centAmount < 20000))) - index products that have at least one variant with a price less than 200.
  • masterVariant(attributes(name="Brand" and value="Algolia")) - index products for which the ‘Brand’ attribute is ‘Algolia’.

Configure your destination

A destination defines where and how the data will be stored in the Algolia indices.

commercetools destination form

After selecting an index name and providing the credentials, choose if you want to index products or product-variants:

  • Product. A record is assigned to each product.
  • Variant. A record is assigned to each product variant.

You can see the records schema for each option in the Product schema section. For more information about which model best suits your needs, see Ecommerce records.

Finally, you can add a list of attributes you want to exclude from your records.

Once finished, click Create destination to set up the destination.

Configure your tasks

A task is the link between source and destination. You run tasks to launch the indexing process.

commercetools task form

The commercetools integration creates two tasks:

  • An On demand task that you can use to trigger a full reindex of your products.

    The task has a Failure Threshold setting that lets you specify a percentage of allowed indexing failures. For example, a failure threshold of 10% requires 90% of your records to import without errors.

  • A Subscription task that automatically updates indexes when a product changes and is published in commercetools.

The Subscription task has two options:

  • Partial record updates: only attributes coming from commercetools are updated in the existing records. If your records have attributes added from another source, they won’t be updated. If a record doesn’t exist, it will be added.
  • Full record updates: the existing records are replaced with commercetools records (see Product schema). If a record doesn’t exist, it will be added.

Click Create task to finish setup.

You can choose when to index your products. Click Run to immediately start indexing your commercetools products.

commercetools launch reindex

You won’t see your products in your Algolia index until you trigger a full reindex.

Trigger a full reindex

After installing a commercetools connector, you need to trigger a full reindex at least once.

You should also reindex if you changed, added, or deleted a source or a destination.

To trigger a full reindex, run the On demand task by clicking Run task:

commercetools run task

Confirm by clicking Run.

commercetools manual reindex

To check the progress and status of your reindex run, go to the Connector Debugger in the Algolia dashboard.

Did you find this page helpful?