Indexing Service
Configure search indexer to bring great searching experience on your storefront.
The Indexing Service is responsible for including all your resources, such as products, or categories, in the search index and make them searchable on your storefront. You have to enable your own indexing service on Emporix by providing your credentials for the index provider into the Commerce Engine platform. The supported index providers are Algolia and BatteryIncluded. Only one provider can be active per tenant at a time.
For complete provider-specific setup and examples, see:
The Indexing Service gives you the possibility to provide your own API keys to the indexing provider, separately for each tenant. This approach gives you more flexibility in configuration.
There are two groups of endpoints in the Indexing Service - secured and public endpoints:
Secured endpoints - require a security scope and are used for managing configuration.
Public endpoints - do not require any security scopes and can be used directly on a storefront.
Even though the public endpoints do not require scopes, an authorization token is required to complete the request.
Reindexing data
Be aware that changing configuration for indexing provider isn't enough to apply your changes in the index. Usually, the indexing process of your data is triggered by changes done on your products, or dependant entities, such as category, price, media etc. There is a scheduler job that discovers the delta changes on the resource data and starts reindexing of the updated instances, so that they are searchable on the storefront.
Applying the changes done to the search index configuration require updating all existing product data. To avoid updating all the data, there is a reindexing mechanism available. So, if you change the index configuration, remember to reindex all your product data by using the reindex endpoint.
For example, after switching to the MERGE strategy with BatteryIncluded as the active provider, run a full reindex to push existing products to BatteryIncluded in the updated document format:
curl --location 'https://api.emporix.io/indexing/{tenant}/reindex' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer {token}' \
--data-raw '{
"mode": "FULL"
}'Indexing strategies
As Emporix is a multi-site solution, data on each site may differ, such as availability or price. Therefore, site-aware data must be included in the index. The Indexing Service provides two index strategies:
SPLIT: The default strategy. The strategy creates as many indices as the number of sites declared in the system. The index item does not contain
sitePricesandsiteAvailabilitiesfields. All the site-aware fields are available on the root level. This approach may be more flexible as a particular index contains only information related to one site. But, the fields that are not site-aware, likedescription,nameetc are duplicated across all the indices. The number of indices is significantly higher.MERGE: An alternative strategy. The strategy creates just a single index that contains information from all the sites. The site-aware information is stored in
sitePricesandsiteAvailabilitiesproperties. These properties are maps where a key corresponds to a site code and a value corresponds to thepriceoravailabilityobject respectively. This approach is more performant as you have only one index.
Changing index strategy
To change the index strategy, use Emporix API and send the request to the Configuration Service.
If there is an already existing configuration for your tenant, send a Updating a configuration (PUT) request. If there is no configuration yet, first send a Creating configurations (POST) request to create one.
If there is no configuration, the SPLIT strategy is used by default.
Propagating changes to the index strategy may take up to 1 hour, so you might not be able to see the changes instantly.
Looking for API tutorials? Check out Indexing Service Tutorial.
Looking for API reference? Check out the Indexing Service in the Emporix API Reference.
Last updated
Was this helpful?

