
So, in this article, we will help you with how to reindex in Magento 2 by using the command line (CMI) and the admin panel.
Table of Contents :
-
What is Magento 2 Reindex?
Reindex Magento 2 is the best way of transforming data on the front end so that users can see it if there is any modification or changes on the website.
Whenever you change the data, it is imperative to reindex that transformed data.
Suppose, if you improve the price of a particular product from $6 to $7, Magento must reindex this change in price to make sure it reflects on your storefront.
-
When is Magento Reindex Required?
In Magento 2, reindex is required for the below eight indexers when changes are made:
- Category Products
- Product Categories
- Product Price
- Product Entity Attribute Value
- Stock
- Catlog Rule Product
- Catlog Product Rule
- Catlog Search
For older Magento versions, indexation depends on the index.php file. However, in Magento 2, it is managed by the bin/magento.
Also Read: A Short Guide On Magento 2 PWA And Integrating It In Magento 2
-
How to Reindex In Magento 2?
Reindexing in Magento 2 can be achieved by two methods, one from backend and other via SSH/Command line (CLI) way. One by one, we will learn each of both approaches.
-
Method 1: Reindexing in Magento 2 via the Command Line
The first one is the use of a command-line to reindex data. You can use this method when you need to issue reindexing data instantly. Here is what you need to follow:
-
Step 1: Log in to your store via SSH or CMI (Command Line)
-
Step 2: Navigate your root directory of your online store.
-
Step 3: Run the command: php bin/magento indexer:reindex
Output :
-
Step 4: Now, check the status of the indexers and identify indexers that need to be reindexed individually by using this command: php bin/magento indexer:status
Output :
-
Step 5: Check the list of indexers and the corresponding indexers status by using this command: php bin/magento indexer:info
Output :
-
Step 6: Reindex each indexer that has status “Reindex Required” by using this command: php bin/magento indexer: reindex [catlog_category_flat]
For reference: php bin/magento indexer: reindex catlogrule_rule
List of indexers:
- php bin/magento indexer:reindex design_config_grid customer_grid
- php bin/magento indexer:reindex catalog_category_product
- php bin/magento indexer:reindex catalog_product_category
- php bin/magento indexer:reindex catalog_product_price
- php bin/magento indexer:reindex catalog_product_attribute
- php bin/magento indexer:reindex catalogsearch_fulltext
- php bin/magento indexer:reindex cataloginventory_stock
- php bin/magento indexer:reindex catalogrule_rule
- php bin/magento indexer:reindex catalogrule_product
-
Step 7: Follow step 4 to check index status again. You should get outpout as “Ready” for every indexers.
That’s all about how to reindex in Magento 2 by using the command line.
-
-
Method 2: Manual Reindex from Admin Panel/Backend
Reindexing of data from the admin panel with Magento 2 backend is another excellent way. Have a look at the below steps to know more.
- Step 1: Login to Magento 2 Admin Panel
- Step 2: From admin panel, go to System > Tools > Index Management. To the right side, the Index Management grid is show you can check indexers status.
- Step 3: Choose the checkbox next to each type of indexer to change.
- Step 4: From the action list, click the indexing mode.
- Step 5: Now, click on the Submit button to apply the selected mode to indexers.
Also Read: You Must Be Familiar With Magento 2.3.4 (Latest Update)
-
Reindexing can be done in two modes:
- 1. Update on Save Mode
- 2. Update by Schedule Mode
Update on Save Mode: In this mode, index tables are updated immediately after the dictionary data gets changed.
When any save action gets complete, then the changes get caught, and the index gets updated.
The index management page updates and flushes the reindex message within a short period.
Update by Schedule Mode: The index is set to update on schedule according to a cron job. The cron job includes the schedule interval for reindexing and writing updates to the index when run.
That’s all about how to reindex in Magento 2. With the help of this, Magento store owner can manage their store more efficiently and bring satisfaction to their customers.
If you still find it challenging to do reindexing in Magento 2 or any further questions regarding this blog, then you can get in touch with Magento experts for any help. You can also drop a comment below, and we will make sure to solve your query.
Happy Indexing!!