Magento Expert Forum - Improve your Magento experience

Results 1 to 13 of 13

Re-indexing Magento through the command line

  1. #1
    Junior Member golddev's Avatar
    Join Date
    Mar 2013
    Posts
    43
    Thanks
    1
    Thanked 8 Times in 4 Posts

    Thumbs up Re-indexing Magento through the command line

    From time to time, you might find the need to re-index Magento via the command line. This could be for a whole host of reasons, for example, if the indexer is timing out or not finishing through the web interface.

    Magento includes an indexing script and you can find it in the shell folder.

    From here, you have a number of commands at your disposal.

    Checking for the status of all indexes



    Code:
    php indexer.php --status
    Should give you output like this:

    Code:
    Product Attributes:            Pending
    Product Prices:                Pending
    Stock Status:                  Pending
    Tag Aggregation Data:          Pending
    Default Values:                Pending
    Catalog URL Rewrites:          Pending
    Product Flat Data:             Require Reindex
    Category Flat Data:            Pending
    Category Products:             Pending
    Catalog Search Index:          Pending

    Re-indexing a single index



    Each index has its own index key that you can use to reference it when asking Magento to re-index. To get these keys, you can use the following command:

    Code:
    php indexer.php --info
    Giving you:

    Code:
    catalog_product_attribute     Product Attributes
    catalog_product_price         Product Prices
    tag_summary                   Tag Aggregation Data
    mana_db_replicator            Default Values
    catalog_url                   Catalog URL Rewrites
    catalog_product_flat          Product Flat Data
    catalog_category_flat         Category Flat Data
    catalog_category_product      Category Products
    catalogsearch_fulltext        Catalog Search Index

    To reindex a single index, run the following command.

    Code:
    php indexer.php --reindex [Index Option Code]
    This can be comma delimited for multiple indices:

    Code:
    php indexer.php --reindex catalog_product_price,catalog_url,catalog_product_flat

    Re-index all indices



    The following code will loop through each index and re-index it.

    Code:
    php indexer.php --reindexall

    View more threads in the same category:


  2. The Following User Says Thank You to golddev For This Useful Post:

    hedkey (05-03-2018)

  3. #2
    New member
    Join Date
    Jul 2015
    Location
    Punjab
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Here are step by step instructions to ReIndex Magento indexers via SSH :

    Firstly, we have to check whether SSH is enabled on our server or not. If it is not enabled, ask your hosting to enable it or you can enable it from WHM.

    1 - After logging in to SSH, type cd public_html ( if magento installation is in public_html ) & hit enter

    2 - Then we have to move in shell directory, for that type cs shell

    3 - To execute re-index process use the command below:

    php -f indexer.php reindexall

    4 - We can do Reindexing for each Reindexer Indvidually, for that type below commands one by one

    php indexer.php --reindex catalog_product_attribute
    php indexer.php --reindex catalog_product_price
    php indexer.php --reindex catalog_url
    php indexer.php --reindex catalog_product_flat
    php indexer.php --reindex catalog_category_flat
    php indexer.php --reindex catalog_category_product
    php indexer.php --reindex catalogsearch_fulltext
    php indexer.php --reindex cataloginventory_stock
    php indexer.php --reindex tag_summary

  4. #3
    Junior Member
    Join Date
    Feb 2016
    Posts
    38
    Thanks
    1
    Thanked 2 Times in 2 Posts

    Default

    Thanks for share the good answer.

  5. The Following User Says Thank You to Mariajerek For This Useful Post:

    hedkey (05-03-2018)

  6. #4
    Junior Member
    Join Date
    Mar 2016
    Location
    india
    Posts
    412
    Thanks
    0
    Thanked 2 Times in 2 Posts

    Default

    Hi,
    Magento uses a lot of resources to re-index data from the Admin Panel. A good way to re-index data without using the admin panel is to use command shell “ssh”. This also would work if you happen to be locked out of the admin panel.

    Here is instruction on how to use default Magento indexer via SSH:

    1 – Go to ‘shell’ folder in your Magento installation:

    *cd shell

    2 – Execute reindex using this command:

    *php -f indexer.php reindexall

    It is possible to get full list of Magento indexer commands using this command:

    *php -f indexer.php help

    To get a list of available indexes, execute this command:

    *php -f indexer.php info

    By default there are 8 indexes in Magento:

    *catalog_product_attribute Product Attributes
    *catalog_product_price Product Prices
    *catalog_url Catalog Url Rewrites
    *catalog_product_flat Product Flat Data
    *catalog_category_flat Category Flat Data
    *catalog_category_product Category Products
    *catalogsearch_fulltext Catalog Search Index
    *cataloginventory_stock Stock status

    Individual commands for re-indexing:

    *php indexer.php --reindex catalog_product_attribute
    *php indexer.php --reindex catalog_product_price
    *php indexer.php --reindex catalog_url
    *php indexer.php --reindex catalog_product_flat
    *php indexer.php --reindex catalog_category_flat
    *php indexer.php --reindex catalog_category_product
    *php indexer.php --reindex catalogsearch_fulltext
    *php indexer.php --reindex cataloginventory_stock
    *php indexer.php --reindex tag_summary

  7. The Following User Says Thank You to sudhakar For This Useful Post:

    hedkey (05-03-2018)

  8. #5
    Junior Member clapcreative's Avatar
    Join Date
    Jul 2015
    Location
    149 Mcafee court , Thousand Oaks CA 91360
    Posts
    116
    Thanks
    3
    Thanked 5 Times in 5 Posts

    Default

    Here is another effective method of Re-indexing Magento Through Command line: -

    Command to check the current status of all indices is:

    php /your-magento-path/shell/indexer.php --status
    php /your-magento-path/shell/indexer.php info
    To refresh the specific index, you need to select a specific indices to index. This will return results like followings:


    catalog_product_attribute Product Attributes
    catalog_product_price Product Prices
    catalog_url Catalog Url Rewrites
    catalog_product_flat Product Flat Data
    catalog_category_flat Category Flat Data
    catalog_category_product Category Products
    catalogsearch_fulltext Catalog Search Index
    cataloginventory_stock Stock status
    Now, to run indexer on any indices you have to run command like this

    php /your-magento-path//shell/indexer.php --reindex catalog_product_price
    OR
    php /your-magento-path//shell/indexer.php --reindex cataloginventory_stock
    The command line approach is considered to be little bit faster than admin panel.


    Vote if Helpful.

  9. #6
    Junior Member
    Join Date
    Jan 2016
    Location
    Rajkot, Gujarat, India
    Posts
    21
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default

    Hi,

    In my case I am trying to re-index magento via command line at that time get an error message, and error message not approved at that time re-index process broken.

    and later i realize that this problem appearing due to lots of product in my database and limited service resources I have.

    Thanks for the code.

  10. #7
    Junior Member
    Join Date
    Feb 2017
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Your article is awesome! How long does it take to complete this article? I have read through other blogs, but they are cumbersome and confusing. I hope you continue to have such quality articles to share with everyone! I believe there will be many people who share my views when they read this article from you!
    vex 3

  11. #8
    Junior Member
    Join Date
    Feb 2017
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Your article is awesome! How long does it take to complete this article? I have read through other blogs, but they are cumbersome and confusing. I hope you continue to have such quality articles to share with everyone! I believe there will be many people who share my views when they read this article from you!
    happy wheels

  12. #9
    Junior Member
    Join Date
    Feb 2017
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thanks for your post! Through your pen I found the problem up interesting! I believe there are many other people who are interested in them just like me! How long does it take to complete this article? I have read through other blogs, but they are cumbersome and confusing. I hope you continue to have such quality articles to share with everyone!
    io games

  13. #10
    New member
    Join Date
    Feb 2018
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    hello to everyone

    i can't understand this topic anyone idea about indexing magneto through command line let me explain

    ISO 9001 Certification in Philippines

  14. #11
    New member
    Join Date
    Mar 2018
    Posts
    6
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    I’m satisfied that you simply shared this helpful info with us. Please keep us up to date like this. Thanks for sharing.
    * gmail sign up

  15. #12
    Junior Member
    Join Date
    Jan 2018
    Location
    New York
    Posts
    36
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Magento 2 Indexing Reindex - Devdocs

    Indexing Reindex is how Magento transforms data such as products, categories, and so on, to improve the performance of your storefront. As data changes, the transformed data must be updated—or reindexed. Magento has a very sophisticated architecture that stores lots of merchant data (including catalog data, prices, users, stores, and so on) in many database tables. To optimize storefront performance, Magento accumulates data into special tables using indexers.

    For example, suppose you change the price of an item from $8.99 to $6.99. Magento must reindex the price change to display it on your storefront.

    Without indexing, Magento would have to calculate the price of every product on the fly—taking into account shopping cart price rules, bundle pricing, discounts, tier pricing, and so on. Loading the price for a product would take a long time, possibly resulting in cart abandonment.

    Overview of creating the indexer


    • Step 1: Create Indexer configuration file
    • Step 2: Create Mview configuration file
    • Step 3: Create Indexer class
    • Step 4: Run a test


    Let’s start to create a custom indexer: Magento 2 Indexing Reindex - Devdocs

  16. #13
    Junior Member
    Join Date
    Jan 2018
    Location
    New York
    Posts
    36
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Magento 2 Indexing Reindex - Devdocs

    Indexing Reindex is how Magento transforms data such as products, categories, and so on, to improve the performance of your storefront. As data changes, the transformed data must be updated—or reindexed. Magento has a very sophisticated architecture that stores lots of merchant data (including catalog data, prices, users, stores, and so on) in many database tables. To optimize storefront performance, Magento accumulates data into special tables using indexers.

    For example, suppose you change the price of an item from $8.99 to $6.99. Magento must reindex the price change to display it on your storefront.

    Without indexing, Magento would have to calculate the price of every product on the fly—taking into account shopping cart price rules, bundle pricing, discounts, tier pricing, and so on. Loading the price for a product would take a long time, possibly resulting in cart abandonment.

    Overview of creating the indexer


    • Step 1: Create Indexer configuration file
    • Step 2: Create Mview configuration file
    • Step 3: Create Indexer class
    • Step 4: Run a test


    Let’s start to create a custom indexer: Magento 2 Reindex - Devdocs

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •