How to Issue a Reindex in Magento 2

    September 21, 2021

    Image by magento.com

     

    Magento 2 doesn’t necessarily have the lowest resource usage footprint, and with good reason. A standard Magento installation generates and stores a considerably high volume of data in the form of stores, catalogs, users, offers, etc. Here is where indexers come in handy.


    Indexers are objects that create an index of all this data to help increase our storefront’s performance and response time, increasing conversion rates. Knowing that, our indexes must be up to date, always showing the most accurate information at any time.


    In this post, we’ll be discussing the two methods to reindex in Magento 2: via the admin panel and through the command-line interface. 


    How to Reindex Magento 2 Through the Admin Panel

    Unlike Magento 1, it is not possible to manually issue a reindex for Magento 2 from the admin panel. Instead, the “Magento_Indexer” performs the tasks for us. We can still set the indexing mode, though. There are two options: “Update on Save” and “Update by Schedule.


    The first option allows the indexer to reindex in real-time, as changes are being made in the admin panel. When we select “Update by Schedule,” it proceeds with the reindex at a specified time, with the help of a Magento cron job. To access the index management panel, we need to go to: 


    System >> Index Management:

    Once we are in the index management panel, we can select the indexing mode of our preference:

    In some instances, our indexers will be invalidated:

    In those cases, we need to reindex all the affected indexers manually, and this has to be done via the command-line interface, as we will show below. 

    How to Reindex Magento 2 Via SSH 

    As previously mentioned, when the indexers are invalid, or if we want to make sure all indexers are reindexed, it is convenient to issue a reindex via the command-line (SSH). 


    The first step is to go to your Magento’s root directory (in this case, /home/coolmsite/public_html). Optionally, we can verify the status of the indexers using the indexer:status command:


    LiquidWeb$ pwd

    /home/coolmsite/public_html


    LiquidWeb$ bin/magento indexer:status

    As we can see, a reindex is required for all indexers. So the last step would be to issue the indexer:reindex command to reindex and fix that up:


    LiquidWeb$  bin/magento indexer:reindex

    Design Config Grid index has been rebuilt successfully in 00:00:00

    Customer Grid index has been rebuilt successfully in 00:00:00

    Category Products index has been rebuilt successfully in 00:00:00

    Product Categories index has been rebuilt successfully in 00:00:00

    Catalog Rule Product index has been rebuilt successfully in 00:00:00

    Product EAV index has been rebuilt successfully in 00:00:00

    The inventory index has been rebuilt successfully in 00:00:00

    Catalog Product Rule index has been rebuilt successfully in 00:00:00

    Stock index has been rebuilt successfully in 00:00:00

    Product Price index has been rebuilt successfully in 00:00:00

    Catalog Search index has been rebuilt successfully in 00:00:00

    That is the expected output, and it was a success. We can verify running again the indexer:status command:



    If we don’t need to reindex all the indexers, we can specify the indexers. In the following example, we will reindex the “Design Config Grid” index and the “Inventory” index:


    LiquidWeb$  bin/magento indexer:reindex design_config_grid inventory

    Design Config Grid index has been rebuilt successfully in 00:00:00

    Inventory index has been rebuilt successfully in 00:00:00

    Need More Help?

    If you need additional help in this topic or any other related matter, reach out to us for 24-hour assistance any day of the year by email or through your Client Portal



    Was this article helpful?

    Send feedback

    Can’t find what you’re looking for?

    Our award-winning customer care team is here for you.

    Contact Support