Magento 2.0 system automatically saves the changes and updates the system.The changes may include anything starting from adding a new category, new products, new catalog, changes in the cost and similarly other data. Magento 2 is not so hard for the expert. Unlike Magento 1 it’s not allowing for manual re index. Magento 2 is allow auto re-index in admin panel for below action.
1. Update on Save.
2. Update by schedule via CRON job.
Magento 2 is tightly coupled with command line interface. The more you use Magento 2 ,the more you’ll know Cli or SSH.
Prerequisites
For this post, you will need:
A system running Ubuntu 16.04
Magento2
Magento 2 re-index via command line:
Go to root directory of Magento from terminal (Linux, window etc.)
cd <magento-root-path>/bin
1. Get list of available indexer in Magento 2 :
#Linux ./magento indexer:info #Windows php magento indexr:info # Output : 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 cataloginventory_stock Stock catalogrule_rule Catalog Rule Product catalogrule_product Catalog Product Rule catalogsearch_fulltext Catalog Search
2. Get status of Magento 2 indexer :
Below command will get you the status of all the indexer whether indexing is required or ready.
#Linux ./magento indexer:status #Windows php magento indexer:status #Output: Design Config Grid: Ready Customer Grid: Ready Category Products: Ready Product Categories: Ready Product Price: Ready Product EAV: Ready Stock: Ready Catalog Rule Product: Ready Catalog Product Rule: Ready Catalog Search: Ready
3.Get individual indexer status
#Linux ./magento indexer:status catalog_product_attribute #Windows php magento indexer:status catalog_product_attribute #Output : Product EAV: Reindex required
4. Reindex all Magento 2 indexer :
#Linux ./magento indexer:reindex #Windows php magento indexer:reindex #Output : Design Config Grid index has been rebuilt successfully in 00:00:04 Customer Grid index has been rebuilt successfully in 00:00:04 Category Products index has been rebuilt successfully in 00:00:00 Product Categories index has been rebuilt successfully in 00:00:00 Product Price index has been rebuilt successfully in 00:00:00 Product EAV index has been rebuilt successfully in 00:00:00 Stock index has been rebuilt successfully in 00:00:00 Catalog Rule Product index has been rebuilt successfully in 00:00:00 Catalog Product Rule index has been rebuilt successfully in 00:00:00 Catalog Search index has been rebuilt successfully in 00:00:04
Note : On windows machine using command prompt you need to run command using php installed or using php.exe path.
Thanks for sharing this useful and great article.
Cron job is necessary to automate task which can save a lot of time.