Magento 2 Index Management

- Magento 2

Index Management in Magento 2

In this tutorial, we cover such important Magento 2 aspect as index management. The below post provides all necessary code, as well as descriptions and explanations related to Magento 2 Index Management.

'

Prerequisites

  1. You should be logged in to the Magento server as a user with permission to write to the file system of Magento. For instance, it is enough to switch to the web server user.

  2. Now, it’s time to  enable Magento commands from any directory; you only have to add the code below to the system PATH.

  1. Please not that shells often have differing syntax; therefore, you should check this page or a similar source for more help. This is how the bash shell CentOS example looks like:

These are some other ways to run the commands:

1.

run them as:

2.

Please note that <your Magento install dir> is a subdirectory of your web server’s docroot. If you have troubles with locating the docroot, click here for help.

More arguments: Common arguments.

How to view the indexers list

Indexers, used in the commands discussed here, can be displayed with the help of the following command:

The list should look like the following one:

How to get indexer status

By using the below command, you can easily check the status of all indexers, or view just selected ones. This is useful when, for example, you need to know whether indexers need to be reindexed.

Please note that by omitting [indexer] you get status of all indexers. If you don’t need all indexers, enter a space-separated list of indexers in [indexer].

The command below will show you the list of indexers:

If you enter the following one:

you will get the below result

Reindexing

Use the following command to perform reindexing:

By omitting [indexer] you will reindex all indexers. If you don’t need all indexers to be reindexed, place a space-separated list of indexers in [indexer].

Enter

and you will get the list of indexers.

Having run this command:

you get the following result:

Please note that reindexing can take a long time in case of large numbers of sore data such as products, categories, customers, and promotional rules.

Indexers Configurations

Additionally, you can set some indexer options. Firstly, you can update on save by using (realtime). This option starts the update of indexed data after every change the Admin. The option is default.

Secondly, it is possible to update indexers by schedule (schedule), so data is indexed according to the Magento cron job schedule.

Additional information about Indexing.

How to view current configurations

If you need current indexer configurations, enter the following command:

The situation with [indexer] is the same as in the previous cases: it is a space-separated list of indexers, or you can omit it to get all indexers’ modes.

Thus, by using the below command

you will get the following result:

How to configure indexers

Now, we can explain how to to specify the indexer configuration. You just need to enter the following command

where

realtime, schedule, and indexer are described above. Choose between realtime and schedule, and perform a necessary action with indexer.

Again, you can view the list of indexers with

Let’s look at an example when you need to change indexers of category products and product categories; you are going to update  them on schedule. Your command should look like the following one:

You will get the below result:

As you can see, Magento 2 Index Management is a simple task. Now, you can easily perform all the described actions. In case of problems, live your comments below – the Firebear team will always help you.

To check the official documentation, related to index management of Magento 2, visit this page: Manage the indexers.

More Magento 2 features, tutorials, and rumours on Firebear

'