Your destination for complete Tech news

Magento 2 – How to Reindex in Magento 2 with Command Line Interface CLI

216 0

Reindexing in Magento is required to reduce the time spent on calculating the final price including cart rules price, bundle price etc. So Reindexing the Magento Catalog after updating the price is essential to show the correct price on the frontend. There are 8 kinds of Magento Indexers, 
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

Following are the ways to reindex the Magento 2 Indexers using Command Line

View all the Indexers

To get the list of all the indexers type the following command on the command line

php bin/magento indexer:info

This shows the list of all the indexers as follows:

catalog_category_product                 Category Products
catalog_product_category                 Product Categories
catalog_product_price                    Product Price
catalog_product_attribute                Product EAV
cataloginventory_stock                   Stock
catalogrule_rule                         Catalog Rule Product
catalogrule_product                      Catalog Product Rule
catalogsearch_fulltext                   Catalog Search

View Indexer Status

Now we know all the names of the Indexers we can check the status of the individual indexers by typing the following command

php bin/magento indexer:status [indexer]

Here, [indexer] is the name of the individual indexer,
for example:
To see the status of the indexer “catalog_category_product” we type the following command line

php bin/magento indexer:status catalog_category_product

To list the status of all indexers, just omit the [indexer],
for example:

php bin/magento indexer:status

This shows the status of all the indexers

Category Products:                                 Reindex required
Product Categories:                                Reindex required
Product Price:                                     Reindex required
Product EAV:                                       Reindex required
Stock:                                             Reindex required
Catalog Rule Product:                              Reindex required
Catalog Product Rule:                              Reindex required
Catalog Search:                                    Reindex required

Reindex

To Reindex the indexers, just type the following

php bin/magento indexer:reindex [indexer]

To Reindex all the indexers, just type the following

php bin/magento indexer:reindex

which will show the following result

Category Products index has been rebuilt successfully in 00:00:04
Product Categories index has been rebuilt successfully in 00:00:09
Product Price index has been rebuilt successfully in 00:00:12
Product EAV index has been rebuilt successfully in 00:00:04
Stock index has been rebuilt successfully in 00:00:12
Catalog Rule Product index has been rebuilt successfully in 00:00:12
Catalog Product Rule index has been rebuilt successfully in 00:00:09
Catalog Search index has been rebuilt successfully in 00:00:09

Leave A Reply

Your email address will not be published.