89

I couldn't find the way to do reindexing in mass actions on magento 2.

Seems like you need to run it from cronjob. Is there an alternative way to reindex data in magento 2 from backend or command line just like it used to be in Magento 1.x (php shell/indexer.php -reindexall) ?

enter image description here

3

12 Answers 12

129

to reindex in magento 2, go to the CLI and then the root folder of your magento installation and run the below command :

php bin/magento indexer:reindex

7
  • 1
    Just figured out from here devdocs.magento.com/guides/v2.0/config-guide/cli/…
    – Harit
    Commented Nov 18, 2015 at 11:03
  • For those who are using mac, they can change directory to installation_dir/bin and write this command ./magento indexer::reindex
    – Harit
    Commented Nov 18, 2015 at 11:04
  • 2
    It says you can accept in 3 minutes xD
    – Harit
    Commented Nov 18, 2015 at 11:13
  • For cron, see also devdocs.magento.com/guides/v2.0/install-gde/install/… Commented Nov 20, 2015 at 12:56
  • I am getting parse error in /Applications/MAMP/htdocs/Magento-CE-2.1.2-2016-10-11-11-16-47/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php on line 93
    – Oli Tuck
    Commented Oct 16, 2016 at 16:22
22

Run this command in your CLI

php bin/magento indexer:reindex

and if you want to reindex only one indexer then write following command:

php bin/magento indexer:reindex indexer_name.

where indexer_name can be found by typing following command :

php bin/magento indexer:info

0
7

Here is how you can get things done using Magento 2 CLI indexing commands

Get into your Magento CLI command file available in Magento/bin directory cd magento_folder/bin and run your command directly using Magento in terminal or putty.

Here is how it will work for indexing in Magento 2

##Get the list of available indexers in Magento 2##

php bin/magento indexer:info

##How to check the status of indexer##

The following command will get you the status of all the indexers whether indexing is required or ready.

php bin/magento indexer:status

You can also check the status of individual indexer: let's say I want to check the status of catalog_category_product

php bin/magento indexer:status catalog_category_product

##How to reindex all available indexing in Magento 2##

php bin/magento indexer:reindex

In case you fill memory limit, try this command

php bin/magento -dmemory_limit=2G magento indexer:reindex
4

Use Magento CLI. Run php bin/magento indexer:reindex from project root directory.

1

If any index is looping You can reset all index by using
indexer:reset
then use normal reindex

1

To Reindex from command prompt run below command:

php bin/magento indexer:reindex

Above command should be run from magento root directory

1

On the Magento root CLI, run the below command

php bin/magento indexer:reset

Then run the below command

php bin/magento indexer:reindex
0

solved with php bin/magento indexer:reindex

0

Sometimes to make it easy, you may want to re-index directly from the admin without involving cron (especially if you haven't setup your cron jobs and the site is still in development). In such cases, you can use the free extension Admin Reindex [M2] which allows you to reindex from the admin.

0

You can re-index by using two different methods.

1- Re-Index from Admin Panel enter image description here

To do so-

Go to System > Tools > Index Management

Select the checkbox next to each type of Indexer to change

Select Indexing Mode from the Acton Dropdown Click Submit

2- Re-Index Using CLI (Command Line Interface)

Run the following Command in your CLI

Bin/magento indexer : reindex [indexer]

To view the list of Indexers-

Run the following Command-

bin/magento indexer : info

Still facing any issue/error, you can read this detailed article on

0

Magento 2 reindex using command line SSH:
php bin/magento indexer:reset && php bin/magento indexer:reindex

Note:
For performance reasons, Magento recommends that you set all indexers to run on "Update by Schedule" and let cron reindex data. Otherwise, every time an object is saved reindex will happen and lead to high CPU usage and MySQL errors. As a best practice, Magento recommend that you use scheduled indexing.

0

Use Update on Schedule instead of Update on Save to run the re-index process with CRON.

Update on Schedule is better than Update on Save. Magento also recommends using the Update on Schedule mode in production because it stores information about data updates and performs indexation by portions in the background through a specific cron job.

Whether the Update on Save mode immediately indexes whenever your catalog or other data changes. It can lead to significant delays and data unavailability during high loads. This mode assumes a low intensity of update and browsing operations in your store.

Check the below official Magento guide for more information regarding indexing. https://docs.magento.com/user-guide/system/index-management.html

Not the answer you're looking for? Browse other questions tagged or ask your own question.