Indexing
Entities

Sync

5min

Entity sync is responsible for sending entity data to Klevu.

The type of API request depends on the next_action column in the klevu_indexing_entity database table. If that column is set to Add then an add request will be sent, if it is empty no request will be sent.

Entity sync is triggered:

  • via cron
  • via CLI

\Klevu\Indexing\Service\EntitySyncOrchestratorService responsible for entity sync. All the above methods of triggering entity sync use this service.

Cron

As with all cron tasks added by version 4.x of the Klevu integration, entity sync cron tasks use the dedicated klevu cron group, allowing granular configuration of scheduling and run options.

We recommend using the native Magento cron to run these jobs, configuring schedules if necessary, rather than a custom server-side cron implementation of the CLI command.

Entity sync runs every 30 minutes by default. This can be configured in the Magento admin, Stores > Configuration > Klevu > Data Sync > Indexing > Entity Indexing Sync Frequency. The default setting can be found here module-m2-indexing/etc/config.xml The configuration for the cron can be found here module-m2-indexing/etc/crontab.xml

module-m2-indexing/etc/crontab.xml


CLI

klevu:indexing:entity-sync

The sync can also be triggered via CLI and has 2 optional parameters

  • api-keys - [optional] comma-separated list of API keys to update
  • entity-types - [optional] comma-separated list of entity types to sync, options:
    • KLEVU_PRODUCT
    • KELVU_CATEGORY
    • KLEVU_CMS

Increasing the verbosity of the command will give you more information using -v, -vv, or -vvv

e.g

Shell


Data

If an attribute has been registered with Klevu for indexing that does not mean it is automatically sent to Klevu. It means it can be sent to Klevu.

Entity data indexed to Klevu is defined in the indexing pipelines YAML files. For custom attributes, you can either

  • enable autogeneration of the YAML files in the admin at Stores > Configuration > Klevu > Developer Settings > Pipelines > Enable autogeneration of configuration overrides
  • add your own YAML file for the attribute - see pipelines customisation