Error: Magento 2 Reindexing One or More Indexes are Invalid

Posted at January 5, 2017 at 4:26 pm by Jithin

Error: Magento 2 Reindexing One or More Indexes are Invalid Make Sure Your Magento Cron Job is Running

This error message is displayed on your Magento admin panel when your data is not indexed properly. Troubleshooting this error is simple and easy. The error message itself gives you a hint on how to address this issue. The only solution is to reindex your Magento data.

Magento Reindexing

 

Indexing

Indexing is how Magento transforms your data such as categories, products, catalogs, and so on. The indexing is performed to improve the performance of your storefront. The transformed data must be updated or reindexed as data changes. Magento stores your merchant data in many database tables. Magento accumulates data into special tables using indexers to optimize storefront performance.

 

Reindex Data

The data reindexing can be easily performed from your Magento admin panel. Follow the below steps to reindex the data.

1) Login to your admin panel as Administrator.

2) Navigate to System > Index Management.

Magento Reindexing

 

3) To update one index only, click the Reindex Data link in the Action column on the right. To update more than one indexer at a time, select the check box next to its name. From the Action list, click Reindex Data and then click Submit.

Magento Reindexing

 

4) Please wait until the re-indexing is completed. Now your indexes are up-to-date.

 

Reindexing Mass Data

The mass data reindexing can be done from command line. You must be logged in to your server as root user to perform it. Follow the below steps to reindex the data.

1) Log in to your server as root user.

2) Navigate to your magento root directory using cd command

$ cd <magento_root_dir>

3) Run the below command to reindex data.

$ php bin/magento indexer:reindex

4) Here is a sample output you will get after running the command.

root@m2[/home/user/public_html]# php 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

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

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

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

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

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

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

5) Your indexes are up-to-date now.

 

Set a Cron Job

You may set a cron job to reindex the data automatically. You can set a cron job via cPanel and command line. Follow the below methods to create a cron job for reindexing.

 

Via cPanel

1) Login to your cPanel.

2) Under cPanel click on Cron Jobs under Advanced tab group.

3) If you have already created a cron job, you can edit it, or create a new cron job.

4) Select the frequency to run the cron job, i.e Once per week (0 0 * * 0).

5) Write the command to re-index the data, as

$ php-cli /home/username/public_html/sub_folder_if_any/bin/magento       indexer:reindex

6) Save it. As per your schedule frequency, the cron job will run.

 

Via CLI

You can create a cron job via command line using crontab command. You must be logged in as root user or the Magento file system owner user to create cron job.

1) Run the command.

$ crontab -u <Magento file system owner user name> -e

2) A text editor displays and edit it with the content below to run a cron job once a week.

00**0 php -f /magento_root_dir/indexer.php reindexall

3) Save it and the cron job for reindexing will run once a week.

 

If you need any further assistance please contact our support department.

 

 

0.00 avg. rating (0% score) - 0 votes

You can skip to the end and leave a response. Pinging is currently not allowed.

Leave a Reply