Shopping cart

Magento 2 Reindex / Indexer Usages via Command Line

In this tutorial, we will talk about Reindex / Indexer Usages via Command Line in Command Line Series. As you know, from Magento 2, they add many commands in bin/magento. This may difficult to get approach this , let me explain more detail about it.

Let show all reindex usages

php bin/magento indexer --help

It will show the following:

indexer                                                                                                                     
 indexer:info                              Shows allowed Indexers                                                           
 indexer:reindex                           Reindexes Data                                                                   
 indexer:reset                             Resets indexer status to invalid                                                 
 indexer:set-mode                          Sets index mode type                                                             
 indexer:show-mode                         Shows Index Mode                                                                 
 indexer:status                            Shows status of Indexer  

Indexer command line

Check indexer status by the following command

php bin/magento indexer:info

We will get result:

design_config_grid                       Design Config Grid
customer_grid                            Customer Grid
catalog_category_product                 Category Products
catalog_product_category                 Product Categories
catalog_product_price                    Product Price
catalog_product_attribute                Product EAV
catalogsearch_fulltext                   Catalog Search
cataloginventory_stock                   Stock
catalogrule_rule                         Catalog Rule Product
catalogrule_product                      Catalog Product Rule
How to Reindexe Data
php bin/magento indexer:reindex
How to Reset indexer status to invalid
php bin/magento indexer:reset
How to Show Index Mode
php bin/magento indexer:show-mode

Result:

$ php bin/magento indexer:show-mode

Design Config Grid:                                Update on Save
Customer Grid:                                     Update on Save
Category Products:                                 Update on Save
Product Categories:                                Update on Save
Product Price:                                     Update on Save
Product EAV:                                       Update on Save
Catalog Search:                                    Update on Save
Stock:                                             Update on Save
Catalog Rule Product:                              Update on Save
Catalog Product Rule:                              Update on Save
How to Set index mode type
php bin/magento indexer:set-mode {realtime|schedule} [indexer]

E.g:

magento indexer:set-mode schedule catalog_category_product catalog_product_category




Enjoyed the tutorial? Spread it to your friends!

magento-2-module-development
command
line
cli
console
indexer
reindex

Comments for Magento 2 Reindex / Indexer Usages via Command Line

Please leave comments if you have any questions, feedbacks.

Module Development

We recommend:

You also may like these Magento 2 Extensions

One Step Checkout

$199
111 reviews

Layered Navigation

$99
59 reviews

Gift Card

$199
6 reviews

Reward Points

$99
4 reviews

Affiliate

$149
12 reviews

Shop By Brand

$99
16 reviews