magento2 reindex command code example
Example 1: magento 2 reindex
php bin/magento indexer:reindex
Example 2: magento shell reindex
php -f shell/indexer.php reindexall
php shell/indexer.php --reindex catalog_product_attribute
php shell/indexer.php --reindex catalog_product_price
php shell/indexer.php --reindex catalog_url
php shell/indexer.php --reindex catalog_product_flat
php shell/indexer.php --reindex catalog_category_flat
php shell/indexer.php --reindex catalog_category_product
php shell/indexer.php --reindex catalogsearch_fulltext
php shell/indexer.php --reindex cataloginventory_stock
php shell/indexer.php --reindex tag_summary
Example 3: set indexer mode command line magento 2
bin/magento indexer:set-mode {realtime|schedule} [indexer]