When a related product is loaded in another one, when we have to reindex this product, a Proxy class is loaded and the reindex causes :
[Elastica\Exception\Bulk\ResponseException]
Error in one or more bulk request actions:
index: /monsieurbiz_product_fr_2022-06-02-171613/_doc/495 caused failed to parse
I dig a lot and the when it's OK the class is a Product :
And when it's not, I have a proxy class :
With a proxy, the Automapper does not map the product and the DTO is an empty array.
This empty array generate the error.
So I created a method to be sure we have the correct entity, and not a proxy while reindexing.
When a related product is loaded in another one, when we have to reindex this product, a Proxy class is loaded and the reindex causes :
I dig a lot and the when it's OK the class is a Product :
And when it's not, I have a proxy class :
With a proxy, the Automapper does not map the product and the DTO is an empty array. This empty array generate the error.
So I created a method to be sure we have the correct entity, and not a proxy while reindexing.