How to Do Re-indexing via Command Line in Magento 2?
Re-indexing using admin panel is ideal for Magento 2 stores with small to medium-sized inventories. However, if you own a Magento 2 based store with a large inventory size, re-indexing via admin panel can be painful for you. In such situation, only command line re-indexing method would work best for you.
To do re-indexing in Magento 2, you need to run the following commands:
• Re-indexing Root Directory:
php bin/magento indexer:reindex
• Re-indexing root/bin directory:
php magento indexer:reindex
• Magento 2 Single Re-indexing Command:
php bin/magento indexer:reindex indexer_name
You will get the indexer name from the following command:
php bin/magento indexer:info
The command line method is considered to be more efficient than admin panel approach. It will execute indexing in a perfect way.