Magento 2: How To Reindex
Magento 2 contains a lot of merchant data, which should be accessed, searched and used - catalogs, prices, stores and many others. They are scattered across different tables, so to improve performance Magento 2 brings they all together in special tables called
Indexers also contain data, which normally are calculated from other properties - for example, prices. It allows Magento to render catalog pages very fast, without a need for recalculating prices on-the-fly. But if you will change price directly in product, changes will not be displayed because indexer will still contain old precalculated data. To make changes apply, you need to reindex Magento 2.
Also, you might need to do reindex in such cases as implementing new store or website, adding or changing new attributes and so on. Everytime you change significant merchant data, you need to perform at least reindex of some indexers.
There are two ways to do it:
Reindexing via Magento 2 Admin
- Log in to Magento 2 Admin and navigate to System → Index Management. You will see the panel above.
- Select indexers, which has status Reindex Required, then select in Actions menu Update on Schedule.
- Press Submit button to apply selected mode to indexers.
This will make your indexers automatically reindex on next cronjob task. It´a a quickest method, because such a crontask runs every minute by default.
Reindexing via SSH/CLI
But sometimes you need to issue reindex instantly. For that SSH/CLI method is more suitable. Here is what you need to do:
- Log in to your store via SSH/CLI and navigate to the root of your store.
- Run the following command:
You should see the following log, which shows, that reindex was successfully completed:
Design Config Grid index has been rebuilt successfully in 00:00:00 Customer Grid index has been rebuilt successfully in 00:00:00 Category Products index has been rebuilt successfully in 00:00:00 Product Categories index has been rebuilt successfully in 00:00:00 Product Price index has been rebuilt successfully in 00:00:01 Product EAV index has been rebuilt successfully in 00:00:01 Catalog Search index has been rebuilt successfully in 00:00:01 Stock index has been rebuilt successfully in 00:00:00 Catalog Rule Product index has been rebuilt successfully in 00:00:01 Catalog Product Rule index has been rebuilt successfully in 00:00:00
Did you know…
…that manual managing of large number of indexers can be complex and takes a lot of time.
Our company offers a simple yet powerful application Asynchronous Re-Indexing, which brings all your indexers one dashboard.
It allows you to instantly run reindex from backend, and even allows you to automate reindexing, making your index management far more simpler.