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:
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
Post a Comment