Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correct index: /<INDEX_NAME>/_doc/<ID> caused failed to parse errors #126

Merged

Conversation

maximehuran
Copy link
Member

@maximehuran maximehuran commented Jun 2, 2022

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 :
image

And when it's not, I have a proxy class :
image

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.

src/Index/Indexer.php Outdated Show resolved Hide resolved
src/Index/Indexer.php Outdated Show resolved Hide resolved
@maximehuran maximehuran merged commit 46d2aab into monsieurbiz:master Jun 7, 2022
@maximehuran maximehuran deleted the feature/avoid-proxies-issues branch June 7, 2022 09:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants