When working with Magento 2, sometimes you will need to reindex to avoid this system message: One or more indexer are invalid. Make sure your Magento cron job is running
What we should do now is reindex the invalid indexers. In Magento 2, we are able to run the indexing using Command Line.
Show list of available indexers
In Magento 2 root directory, use the command to get the information:
php bin/magento indexer:info
Reindex all available indexers
In order to do the whole index management process, we have to run the following commands from Magento 2 root directory, use the command:
php bin/magento indexer:reindex
Or in the root/bin directory, use the command:
php magento indexer:reindex
Check status of indexer
You can check status of indexer using the following command:
To check status of a single indexer, execute this command
magento indexer:status name_of_indexer
In order to run single re-indexing command, use the command:
php bin/magento indexer:reindex indexer_name
The indexer name is the one that we received from the previous command.
That comes to the end of the tutorial. Hope that your re-indexing process work perfectly. If you have any further contribution, please leave us with your comments.