We are thinking how we will run the indexing using command line and which command we will use to run this.

Now here we are describing the command:

If we need to do whole index management in the site we will run the following command in project

In root magento directory

php bin/magento indexer:reindex

 

in root/bin directory

php magento indexer:reindex

To get the index name to run index one by one first write below command to get info

in magento root directory

php bin/magento indexer:info

To run single reindexing command

php bin/magento indexer:reindex indexer_name

indexer name which we received name from indexer:info

Execute the command from command line and be happy. Indexing will work perfectly.