Magento 2 Indexer

Magento 2 Indexer, what is it and why is it needed in your Magento 2 store and how do you reindex.

Magento 2 - How to reindex ? #

Indexer #

What is a Indexer ?

A database index is a data structure that improves the speed of data retrieval operations on a database table at the cost of additional writes and storage space to maintain the index data structure.

Magento has a complicated architecture that stores merchant data in many database tables:

  • Catalog Data
  • Prices
  • Users
  • Stores

What Does Reindexing Do #

To optimize frontend performance, data in the list above is accumulated into special tables using indexers called index tables.

Indexer List #

View list of all Magento 2 indexers via command line:

$ bin/magento indexer:info

Above output for indexer info can be the following:

design_config_grid                       Design Config Grid
customer_grid                            Customer Grid
catalog_category_product                 Category Products
catalog_product_category                 Product Categories
catalogrule_rule                         Catalog Rule Product
catalog_product_attribute                Product EAV
catalog_product_price                    Product Price
catalogrule_product                      Catalog Product Rule
cataloginventory_stock                   Stock
catalogsearch_fulltext                   Catalog Search

Indexer status #

View the status of all Magento 2 indexers via command line:

$ bin/magento indexer:status

The output of index status can be:

+----------------------+--------+-----------+-----------------+------------------+
| Title                | Status | Update On | Schedule Status | Schedule Updated |
+----------------------+--------+-----------+-----------------+------------------+
| Catalog Product Rule | Ready  | Save      |                 |                  |
| Catalog Rule Product | Ready  | Save      |                 |                  |
| Catalog Search       | Ready  | Save      |                 |                  |
| Category Products    | Ready  | Save      |                 |                  |
| Customer Grid        | Ready  | Save      |                 |                  |
| Design Config Grid   | Ready  | Save      |                 |                  |
| Product Categories   | Ready  | Save      |                 |                  |
| Product EAV          | Ready  | Save      |                 |                  |
| Product Price        | Ready  | Save      |                 |                  |
| Stock                | Ready  | Save      |                 |                  |
+----------------------+--------+-----------+-----------------+------------------+

Indexer Mode #

Magento can perform indexing in 2 modes:

  • Update on Save - index tables are updated immediately after data, ex Products, are changed.
  • Update by Schedule - index tables are updated by cron job, ignoring immediate changes, according to the configured schedule.

To view the index mode set for each type you can run the following command:

$ bin/magento indexer:show-mode

This will show the modes each index is set to:

Design Config Grid:                                Update on Save
Customer Grid:                                     Update on Save
Category Products:                                 Update on Save
Product Categories:                                Update on Save
Catalog Rule Product:                              Update on Save
Product EAV:                                       Update on Save
Product Price:                                     Update on Save
Catalog Product Rule:                              Update on Save
Stock:                                             Update on Save
Catalog Search:                                    Update on Save

Indexer Mode Set #

Indexer Mode Set Command Line #

To Specify a index mode for a index type, for example Category Products, you can use command:

$ bin/magento indexer:set-mode realtime <type>

To set it to Update on Save or for setting it to Cron schedule, also known as Update by Schedule :

$ bin/magento indexer:set-mode schedule <type>

Where <type> is one or multiple of Index list

The output of the mode set can be:

Index mode for Indexer Design Config Grid was changed from 'Update on Save' to 'Update by Schedule'

or

Index mode for Indexer Design Config Grid was changed from 'Update by Schedule' to 'Update on Save'

depending on the <type you chose.

Reindex #

How to reindex in Magento 2 ? This can be done using different ways:

Reindex Command Line #

Magento 2 reindex command line by executing following command:

$ bin/magento indexer:reindex

The output of the reindex command should look like:

Design Config Grid index has been rebuilt successfully in 00:00:00
Customer Grid index has been rebuilt successfully in 00:00:01
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:02
Product EAV index has been rebuilt successfully in 00:00:01
Product Price 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
Catalog Search index has been rebuilt successfully in 00:00:01

Reindex Backend #

Magento 2 reindex trigger via Admin Area has been removed by decision of the Magento team. Only the option to change the Indexer Mode has been left available to configure. We recommend to have the Indexer Mode on Update on save.

  • Login into the Admin Area
  • Go to System in left area and select Index Management
  • On the Index Management page, in the grid list use Select All or click on the desired Indexer thick.
  • Use the Actions select and set to Updated on save, then click Submit

Reindex Without SSH #

Magento 2 reindex without SSH on demand is not a possibility as the Reindex Backend functionality has been removed.

Published: Dec 23, 2018. Updated: May 21, 2020.


Magento 2 SEO

We will help you with SEO ratings by providing some Magento 2 SEO Tips

Read

Magento 2 Sitemap

Magento 2 Sitemap Tutorial on How to Configure a Sitemap, where is the path and how to use in multistore.

Read
Magento 2 Import

Magento 2 Import

Magento 2 Import tutorial and How To for Products Import, Categories Import, Customers Import or Tax Rates Import.

Read

Magento 2 Upgrade

The guide to upgrade Magento 2 stores using Composer, Wizard or Manually and how to handle Errors during the process.

Read

Magento 2 Cache

Magento 2 Cache tutorial on different usage scenarios and why Cache should be enabled on your store.

Read
Contact
Hire us


Need help with Magento 2 Indexer ?


Tech

Technologies we work with

Magento is an open-source e-commerce platform written in PHP
PHP is a popular general-purpose scripting language that is especially suited to web development.
MySQL is an open-source relational database management system.
Redis is an in-memory data structure project implementing a distributed, in-memory key-value database with optional durability.
Varnish is an HTTP accelerator designed for content-heavy dynamic web sites as well as APIs.
Google Tag Manager is a free tool that allows you manage and deploy marketing tags on your website / app
Google Analytics is a web analytics service offered by Google that tracks and reports website traffic
Elasticsearch is a search engine based on the Lucene library.