I have a custom index my_index that observe the change in a custom table entity_data. When changes happen in entity_data, my index's execute function is called by Magento like this $indexer->execute([$id1, $id2]);. I know I can reset the whole index by this command:

bin/magento indexer:reset my_index

And I want to build a similar command for my index which only reset some specific ids, something like:

bin/magento indexer:reset_custom my_index "id1,id2"

So the cron job can run it by schedule. Any help will be really appreciated.

2 Answers 2


You can achieve your goal by cron job. You can set your indexer to run by schedule. Look this once for further clarifications : Magento2 reindex via cron job

Or if you want to do with code this may help you : How to set the cron job for indexing in magento2?

  • Yes I am aware of cron job and it is already set up and running. My problem is I want to schedule indexer run for specific ids, like when you edit a product and the indexer will reindex the product id.
    – Hieu Duong
    Jun 7, 2021 at 1:29

You can create a CLI command line to handle your requests. How to add CLI commands

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.