Rate this post

Part 2: Manage indexers using CLI

Welcome to our serial articles on Magento 2 Command Lines (CLI)!

You know Magento 2 has provided the powerful command-line interface tool (CLI). It allows you to perform tasks including installation, configuration, database backups, compiling LESS etc. Today I will show you how to manage indexers in Magento 2 using CLI. Before starting this guide, please review our previous posts.

Use All Commands in Magento 2 CLI
Use All Commands in Magento 2 CLI

1.View the list of indexers in Magento 2

php bin/magento indexer:info

You got the result below

 

2.1 View status of an indexer2.View Indexers status in Magento 2

php bin/magento indexer:status [indexer]

View status of cateogry_product indexer

php bin/magento indexer:status catalog_category_product

2.2 View status if all indexers

php bin/magento indexer:status

You got the result below

3.Reindex in Magento 2

3.1 Reindex an indexers

php bin/magento indexer:reindex [indexer]

Reindex Stock in Magento 2

php bin/magento indexer:reindex cataloginventory_stock

3.2 Reindex all indexers

php bin/magento indexer:reindex [indexer]

4. Then you got the result below


  1. View current configuration of Indexers in Magento 2

4.1 View configuration of an indexer

php bin/magento indexer:show-mode [indexer]

View configuration of catalog_product_price indexer

php bin/magento indexer:show-mode catalog_product_price

4.2 View configuration of all indexers

php bin/magento indexer:show-mode

Then you got the result below

5.1 Configure an indexer5.Configure Indexers in Magento 2

php bin/magento indexer:set-mode {realtime|schedule} [indexer]

Configure Catalog Search Index to update realtime

php bin/magento indexer:set-mode realtime catalogsearch_fulltext

Configure Catalog Search Index to update on schedule

php bin/magento indexer:set-mode schedule catalogsearch_fulltext

5.2 Configure all indexers

php bin/magento indexer:set-mode {realtime|schedule}

Configure all indexers to update realtime

php bin/magento indexer:set-mode realtime

Your Magento website needs a powerful Magento ERP for stock control.

DON'T MISS THE CHANCE!

magento erp

Confirmation and Alert Jquery Widget in Magento 2
How to Use WYSIWYG Editor in Configuration Section in Magento 2