Magento 2: How to create new indexer for your custom module

For this tutorial we will consider an example of a custom module called Vendor_ModuleName. Create below files to generate a new VSBridge indexer and Elastic Index for your own module:

Vendor_ModuleName\etc\indexer.xml

Vendor_ModuleName\etc\mview.xml

Vendor\ModuleName\Model\Indexer\CustomIndexer.php

Now, open console and run below command:
You will now see following:
  • A new indexer job for your module in Magento admin panel > System > Tools > Index Management
  • A new index in elastic
  • You can refresh your indexer with
    php bin/magento indexer:reindex my_custom_indexer

Comments

Popular posts from this blog

XDebug - PHPStorm - Mac: How to configure Xdebug with PHPStorm on Mac OS and PHP 7.3

Magento 2 - Vue Storefront PWA Integration: How to create a new VSBridge indexer job and Elastic Index for your custom module