0

I am getting the error:

One or more indexers are invalid. Make sure your Magento cron job is running.

I know that I could fix this using the command php bin/magento indexer:reindex using the Magento CLI, however I am using a shared hosting, which doesn't let me use a command line to execute this command. Any ideas how to reindex without CLI?

2 Answers 2

0

You can do reindexing by thee ways without CLI

1) from the admin side go to System > Tools > Index Management to set the indexing mode [Update on Save OR Update by Schedule][reference: https://support.weltpixel.com/hc/en-us/articles/115000355673-How-to-reindex-your-Magento-2-store-from-admin-or-SSH-CLI]

2) Via set up cron get a reference from here https://devdocs.magento.com/guides/v2.0/install-gde/install/post-install-config.html#post-install-cron

3) put below code into your controller and you can run when you need it

public function reindexAll() {
    $indexerFactory = $this->_objectManager->get('Magento\Indexer\Model\IndexerFactory');
    $indexerIds = array(
        'catalog_category_product',
        'catalog_product_category',
        'catalog_product_price',
        'catalog_product_attribute',
        'cataloginventory_stock',
        'catalogrule_product',
        'catalogsearch_fulltext',
    );
    foreach ($indexerIds as $indexerId) {
        echo " create index: ".$indexerId."\n";
        $indexer = $indexerFactory->create();
        $indexer->load($indexerId);
        $indexer->reindexAll();
    }
}
0

a. Reindex from Magento admin *sometimes not all indexers are reindexed using admin reindex > check also reindex via SSH

  1. Go to System > Index Management and check indexers status

  2. Select the items that are marked as "Reindex required" and go to Actions > Update on schedule

This will trigger a reindex for selected indexers.

Important: Sometimes not all indexers are reindexed using admin reindex even if time & date is showing as updated in magento admin. We recommend to double check the reindex process using the SSH/CLI reindex method presented below.

Reindex mode: You can set your indexers as "Update on Save" and store entities will be indexed when saving admin configurations or as "Update by Schedule" and indexers will be reindexed recurrently (default once / day) . In order for "Update by Schedule" to work ok, make sure your cron jobs are running correctly on your server. Your hosting partner or development team can help you with the cron jobs configuration.

Resourse from reindex information

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.