Content Hub

Resetting and reindexing entities by content type in Content Hub 1.x


Content Hub 1.x will reach end-of-life on September 30, 2024. Acquia recommends you to upgrade to Content Hub 3.x. For more information, see Upgrading from Content Hub 1.x to 3.x.

If you alter the content type configuration for a content type that you are exporting to Content Hub, search mappings for that content type may no longer correctly function. For example, after changing a field from a list of names to an entity reference, the field now cannot be used by Content Hub or indexed by the Elastic Search Index.

To address this, you can use the ach-reset [entity_type] Drush command to clear all entities of that content type from Content Hub, reset that content type’s mapping, reindex all entities of the specified type, and then republish them back to Content Hub.

For ach-reset [entity_type] to fully remove, reindex, and republish all entities of a certain type, it must be executed twice. Before executing, the command performs the following tests as a fail-safe to determine whether or not resetting and reindexing can proceed:

Does this website have a registered webhook for notifications?

Without a registered webhook for notifications after the reindex completes, the content will never begin the republishing process.

Is this entity type in use by multiple websites?

If yes, removing content will affect only content published by this website, because a website cannot delete other websites’ content. You must manually delete the content from the other websites using other means, such as the ach-delete command. The ach-reset command will provide you with a list of matching entities and their originating websites.

Has the reindex state variable been set to** Reindex Completed?

When a reindex request is sent, the reindex variable is set to Reindex Sent, and until the webhook notifies the website that the reindexing process is complete (setting the variable to Reindex Completed) Content Hub will accept no additional reindexing requests.

First execution

If no reindex request currently exists, executing drush ach-reset will cause Content Hub to perform the following steps:

  1. Mark all entitles of the specified type exported by this website for later re-export.
  2. Delete all entities of the specified type from Content Hub. Note that as a result, entity mappings for Search are also deleted.
  3. Trigger a reindex request using a webhook to Content Hub.
  4. Set the reindex variable to Reindex Sent, which indicates that the website is waiting for Content Hub to reindex all content of the specified type.
  5. Reindex all content of the specified type from this website.
  6. Send a webhook to the website notifying it that the reindex is complete.

The website will change the Reindex state variable to Reindex Completed, which cancels the waiting mode and indicates that it is ready to re-export entities of the specified type to Content Hub.

Second execution

For the second execution of drush ach-reset, if a reindex request has been marked Reindex Completed, Content Hub will use the Batch API to re-export the previously-deleted entities back into Content Hub, using the current type mappings.