Difference between revisions of "Magento 2 Reindex via the CLI"

From Brian Nelson Ramblings
Jump to: navigation, search
(Created page with "==Magento 2 - Reindex via the CLI== This article shows how you can reindex Magento 2 index types using the command line. The first thing you will want to do is determine whi...")
 
(No difference)

Latest revision as of 04:39, 19 June 2019

Magento 2 - Reindex via the CLI

This article shows how you can reindex Magento 2 index types using the command line.

The first thing you will want to do is determine which indexes need reindexed

Check Status

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

php bin/magento indexer:status

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

From the above output, you will noticed that Product Price and Catalog Search need indexed

Getting the indexer name/type

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:

php bin/magento indexer:info

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

With this information we can running the following commands to reindex just the specific indexes that require it

Reindex specific indexes

php bin/magento indexer:reindex catalog_product_price catalogsearch_fulltext

Running the above command will output something like this:

Product Price index has been rebuilt successfully in 00:00:23
Catalog Search index has been rebuilt successfully in 00:00:15

Reindex all indexes via CLI

This is done with the same command as above, but without specifying individual indexes.

php bin/magento indexer:reindex

Sample output:

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