Home » Magento, Magento 220 November 2017

Magento 2: Reindex via Command Line

This article shows how you can reindex Magento 2 index types using the command line. In my previous article, I have listed out all the command line tools that can be used in Magento 2. This article specifically shows about commands to reindex Magento 2 index types.

Get Index Types Info

First of all, let’s get the information/list of all the index types present in Magento 2. For this, we use the following command:

Running the above command will output something like this:

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

So, we now know the list of all the index types.

Check Status

Let’s check the status of all the index types using the following command:

Running the above command will output something like this:

Design Config Grid: Ready
Customer Grid: Ready
Category Products: Ready
Product Categories: Ready
Product Price: Reindex required
Product EAV: Ready
Catalog Search: Reindex required
Stock: Ready
Catalog Rule Product: Ready
Catalog Product Rule: Ready

Check individual indexer status

You can also check the status of individual index types. Let’s check the status of index types “Category Products” and “Product Categories”.

Running the above command will output something like this:

Category Products: Ready
Product Categories: Ready

Reindex

Reindex individual index types

In the above status result, we can see that “Product Price” and “Catalog Search” require reindexing. Let’s reindex them.

Running the above command will output something like this:

Product Price index has been rebuilt successfully in 00:00:20
Catalog Search index has been rebuilt successfully in 00:00:12

Reindex all index types

If you want to reindex all index types, then you need to run the following command. We use the same indexer:reindex command but without specifying any indexer type. Hence, this will apply for all index types.

Running the above command will output something like this:

Design Config Grid index has been rebuilt successfully in 00:00:04
Customer Grid index has been rebuilt successfully in 00:00:06
Category Products index has been rebuilt successfully in 00:00:02
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:00
Catalog Search index has been rebuilt successfully in 00:00:04
Stock index has been rebuilt successfully in 00:00:01
Catalog Rule Product index has been rebuilt successfully in 00:00:00
Catalog Product Rule index has been rebuilt successfully in 00:00:00

Hope this helps. Thanks.

Magento 2

Get New Post by Email

Find me on

FacebookTwitterGoogle+LinkedInRSS Feed