Skip to content
This repository has been archived by the owner on Jun 11, 2024. It is now read-only.

Reindex per store indexes all stores in ElasticSearch #91

Closed
rain2o opened this issue Aug 2, 2019 · 2 comments
Closed

Reindex per store indexes all stores in ElasticSearch #91

rain2o opened this issue Aug 2, 2019 · 2 comments

Comments

@rain2o
Copy link
Contributor

rain2o commented Aug 2, 2019

I noticed when running bin/magento vsbridge:reindex --store=1, the command only runs for the specified store in Magento's context, however it still reindexes all ElasticSearch indexes for all stores.

I discovered this when trying to delete and recreate the index for each store because I had an attribute change its type and the reindex was failing due to the schema mismatch. I tried to run the command above to reindex one store to start with, and noticed all of the other stores throwing errors like this in var/log/vsbridge-indexer/info.log:

vsbridgeIndexerLogger.ERROR: Bulk index operation failed 1 times in index vue_storefront_catalog_en_us for type product. Error (mapper_parsing_exception) : failed to parse [my_attribute]. Failed doc ids sample : 1.

It does delete the index for only the specified store, as it is using the IndexOperations to run that command which accepts the store as a param. So the result is each time I run this for a store, it re-runs the index in ES for all stores, but only deletes and recreates the specified store.

I understand the challenge of resolving this as the index action $indexer->reindexAll(); calls Magento's indexer which then calls each of the indexers in these modules. At the moment I don't have any solutions to recommend, but thought I'd post it here for further discussion.

Hopefully the explanation makes sense. I feel like I kind of wrote in circles here. Let me know if you need some clarity.

@afirlejczyk
Copy link
Contributor

afirlejczyk commented Aug 5, 2019

I will take a look.
vsbridge: reindex command is experimental and I only check it for one store. ;)

We probably use something else instead of indexer->reindexAll();.
We can probably use $action->executeFull as reindexAll() is deprecated.

Nevertheless, we are getting stores using Divante\VsbridgeIndexerCore\Indexer\StoreManager - so I think we can make some modification here and we will be able to export data to ES only for specific store.
Like add a method "setStoreIds" and use these values.
I will take a look on #92 first, and then think on fix.

@afirlejczyk
Copy link
Contributor

@rain2o #96
This changes will do the trick, we can update data in ES only for specific store.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants