How to Reindex Your Magento 2 Store
An important part of Magento 2 is indexing, as without it information load at the front-end would take a long time, possibly resulting in decrease of user satisfaction and sales.
So in case you have received the notification: “One or more indexers are invalid. Make sure your Magento cron job is running”, navigate to System -> Index management section of your admin panel. There you can see what exactly items are marked with ‘Reindex required’ status.
You can check your reindex mode. You can set your indexers to:
- "Update on Save" - store entities will be indexed, when admin configurations are saved.
- "Update by Schedule" and indexers will be refreshed each recurring period of time. In order automated reindex to work, make sure your cron jobs are running correctly on your server. Your hosting partner or developer can help you with the cron jobs configuration.
Unlike Magento 1, there is no out-of box option to run manual reindex in Magento 2. It might be an obstacle, especially when you have just made massive changes to your catalog and want to check if updates were applied successfully without having to wait, or in case you are working on localhost or on dev site, where you don’t have any cron job.
Run Magento 2 Reindex Using Command
There are lots of tutorials online explaining this, however, non-tech people might get confused and look for step-by-step explanation on what exactly details are needed and where to paste them.
So first of all, you need SSH access details. If you have cPanel access, you can generate them yourself in Advanced Section -> SSH/Shell Access. If you have no idea what this is, ask your developer, administrator or hosting provider to send you SSH access details.
Next you need SSH client to use the above mentioned credentials to log in. You can use free program called PyTTY. After it is being installed, start it and input received earlier access details.
When the remote server's command line prompt appears, you are connected. The initial command line prompt looks like small black screen with username and the symbols [~]#.
To run command you need to be located in your store root directory. How to know this? If you see ‘app’ directory, you are there, if not, directory can be changed to the one where Magento is installed, using this command cd public_html. To view files of this directory use dir or ls.
After you have reached the directory containing ‘app’ folder, paste the following command:
php bin/magento indexer:reindex
This command will execute full reindex and you will see line informing you that it was rebuilt successfully.
How To Reindex Magento 2 Clicking a Button
For people without tech skills and background the above mentioned instructions can seem too complicated. So those who get used to perform some action clicking a button, rather than running a command, might refer to alternative way.
Store Manager for Magento application allows to rebuild index with a few mouse clicks!
The application includes options to run reindex for your products, categories or catalog. This way you can send request to trigger reindex procedure directly from the app.
Moreover, performing massive inventory updates or uploading new products to your Magento 2, you can configure setting to refresh indices right after import. So you will not have to spend additional time on that.