Ora

How to Reindex in Magento 2 from Admin?

Published in Magento 2 Indexing 5 mins read

Reindexing in Magento 2 from the admin panel primarily involves managing the indexing modes to ensure your store's data is consistent and optimized for performance. By setting the appropriate indexing mode, you can control when and how your store's data is updated.

Setting Indexer Mode to 'Update on Schedule' for Reindexing

To manage your indexers and set them to 'Update on Schedule' mode, which triggers reindexing via cron jobs, follow these steps:

  1. Access Index Management:
    • Log in to your Magento 2 Admin panel.
    • Navigate to SystemIndex Management.
    • You will see a list of all Magento indexers and their current statuses.
  2. Select Indexers and Choose Action:
    • Identify indexers that show a status of "Reindex Required". These are the indexers that need attention.
    • Select the checkboxes next to the specific indexers you wish to manage.
    • In the Actions dropdown menu (located above the grid), select "Update on Schedule".
  3. Apply the Mode:
    • After selecting "Update on Schedule," click the Submit button to apply the selected mode to the chosen indexers.

Once set to "Update on Schedule," the actual reindexing process will be handled by Magento's cron jobs, which run periodically in the background.

Understanding Magento 2 Indexing

Indexing is a crucial process in Magento 2 that transforms raw store data (like product prices, categories, and user data) into a format optimized for quick retrieval. Without proper indexing, your store's frontend performance would suffer significantly, leading to slow page loads and a poor user experience.

  • What is Indexing? Magento stores a vast amount of data in its database. When you add a new product, change its price, or modify a category, this data needs to be processed and organized into specialized index tables. These index tables allow Magento to fetch and display information rapidly, rather than performing complex calculations on the fly for every user request.
  • Why is it Important? Efficient indexing ensures your customers see up-to-date product information, accurate prices, and correctly filtered search results. It directly impacts your store's speed, searchability, and overall user experience, which are vital for SEO and conversions.

Indexer Modes: 'Update on Save' vs. 'Update on Schedule'

Magento 2 offers two primary modes for managing your indexers, each suited for different operational needs:

Mode Description Best For Considerations
Update on Save In this mode, Magento reindexes data immediately whenever a change is saved in the admin panel. For example, if you change a product's price, the index for product prices will be updated instantly. Small stores, development environments, or when immediate data reflection is critical for minor changes. Can slow down admin operations on large stores due to synchronous reindexing. Not recommended for frequent mass updates.
Update on Schedule In this mode, Magento processes reindexing through its cron jobs. Changes are flagged, and the reindexing occurs during scheduled background tasks, typically every minute (depending on cron configuration). This is the mode set via the steps above. Larger stores, production environments with frequent data changes, or for bulk operations. Requires properly configured Magento cron jobs. Data changes might not reflect on the frontend instantly but within minutes.

To ensure timely reindexing when using 'Update on Schedule', it is critical that your Magento cron jobs are properly configured and running on your server. You can typically verify this via your server's command line or by consulting your hosting provider.

Checking Indexer Statuses

Understanding the status of your indexers helps you identify when action is needed:

  • Ready: The indexer is up-to-date and consistent with the latest data.
  • Reindex Required: This status indicates that changes have occurred in your store's data (e.g., new products added, prices changed, categories modified) that require the indexer to be rebuilt to reflect these updates. This is when you would typically select the indexer to change its mode to 'Update on Schedule' as described above.
  • Processing: The indexer is currently being rebuilt. This status usually appears when an 'Update on Schedule' job is running or if a manual reindex was triggered via the command line.

Best Practices for Reindexing

  • Regular Cron Job Verification: For stores running on 'Update on Schedule' mode, regularly verify that your Magento cron jobs are running correctly. Issues with cron can lead to outdated indexes and performance problems.
  • Understand Your Store's Needs: Choose the reindexing mode ('Update on Save' or 'Update on Schedule') that best suits your store's size, traffic, and frequency of data changes. Most production stores benefit from 'Update on Schedule'.
  • Reindex After Major Changes: Always ensure a full reindex (either manually or by verifying cron completion) after major data imports, upgrades, or significant configuration changes.
  • Monitor Performance: Keep an eye on your store's frontend performance after reindexing, especially if you switch modes or encounter issues.

By following these steps and understanding the principles of Magento 2 indexing, you can effectively manage your store's data consistency and performance directly from the admin panel.