Magento 2 Reindex: manual reindex from the admin panel or a cron job

What is Magento 2 index

Due to the sophisticated architecture, Magento gathers a lot of merchant’s data, e.g.: catalog info, prices, users, stores, in many database tables. To optimize the Magento 2 frontend performance the most important information is stored into special tables using indexers that gathering the data. You need to keep the indexes up-to-date to show actual data on the storefront. 

When Magento 2 reindex is required

In Magento 2 reindex is required for these 8 indexers when any changes are made:

  1. Category products;
  2. Product categories;
  3. Product price;
  4. Product entity attribute value;
  5. Stock;
  6. Catalog rule product;
  7. Catalog product rule;
  8. Catalog search.

In older Magento versions indexation is dependent on the indexer.php file placed under the shell folder. In Magento 2 it’s managed by the bin/magento instead.

Also, you can check what indexer require reindexing in Magento 2 admin panel. For this, go to System > Tools > Index Management.

What is Magento 2 Reindex?

Magento 2 Reindex is the process of updating the transformed data as the data changes. E.g.: when updating a product price the data should be reindexed to be correctly displayed on the frontend. The indexation sufficiently reduces time spent on calculating a final order price including cart price rules, bundle pricing, discounts, tier pricing, etc.

Why reindex Magento 2 via cron?

Magento 2 reindex via cron gives you the ability to clear the cache and re-index Magento session files. When the catalog and other prices are updated from the back end, but not from the frontend, you need to clear the var/cache of Magento, but this process takes time each time. Magento reindexing via cron can be used to automatically clear the cache, making the process easier and more convenient.

What is a Magento 2 indexer?

Magento 2 Indexer is a term that refers to the object that creates the index. If you created a product label and set conditions to determine when the label should be applied, then without indexers, when the product page loads, Magento 2 will have to check each label to make sure it meets the conditions you set. The indexer helps to increase the speed of the store and allows you not to lose conversions.

How to reindex Magento 2?

So, how to reindex in Magento 2? Magento reindex can be made in 2 ways: reindex via a cron job and use manual reindex from the admin panel.

Reindex via a cron job

Reindex Magento 2 via a cron job is a very convenient way. In this case, Magento 2 reindexing runs every minute (you can set an appropriate period) eliminating the necessity to manage the process manually. To configure a cron job correctly follow the guide.

Manual reindex from the Admin Panel

You can force Magento 2 reindex via the command line:

  • Log in to your Magento server admin panel as the file owner;
  • Use the next Magento 2 reindex command: php bin\magento indexer:reindex where [indexer] is a space-separated list of indexers;
  • The option is suitable for reindexing all the Magento 2 store: php bin\magento indexer:reindex. In this case, you’ll see the corresponding results:


However, reindexing of all Magento 2 indexers can take long, therefore, you’d better manage a cron job for the issue.

  • If you want to see the list of all Magento 2 indexers available for reindexing, type in the command line: php bin\magento indexer:info. Here you can find the name of a definite indexer, which is to be further reindexed through the Magento 2 command: php bin\magento indexer:reindex indexer_name (the name of a desired indexer is applied to the ‘_name’ part). 

Learn how to create custom Magento 2 indexer programmatically and reindex it via cron.

Helpful hint: If you need a complex solution to prevent your M2 store from lags due to the too long loading, try out this Reindex from Admin. Having installed it, you'll reindex data in a click right from the admin panel, automate the reindexing, check the reindex process in a live regime.

How can we help you?

Didn’t you find the answer to your question? We are always happy to help you out.