Skip to content
This repository was archived by the owner on Mar 8, 2023. It is now read-only.
This repository was archived by the owner on Mar 8, 2023. It is now read-only.

Getting a lot of "illegal_argument_exception" when importing data from Magento 2 #98

@jahvi

Description

@jahvi

Current behavior

When running yarn mage2vs import you get a lot of illegal argument exceptions when trying to update records in ES.

Example

error: uncaughtException: [illegal_argument_exception] Rejecting mapping update to [vue_storefront_catalog] as the final mapping would have more than 1 type: [category, cms_block] :: {"path":"/vue_storefront_catalog/cms_block/18/_update","query":{},"body":"{\"upsert\":{\"store_id\":[0],\"id\":18,\"identifier\":\"login-data\",\"title\":\"Login Info Block\",\"content\":\"<div class=\\\"message info\\\" style=\\\"margin-top: 50px;\\\">\\n    <p><strong>Try Demo Customer Access</strong></p>\\n    <p><span style=\\\"display:inline-block; width: 80px; padding-right: 10px;\\\">Email:</span>roni_cost@example.com</p>\\n    <p><span style=\\\"display:inline-block; width: 80px; padding-right: 10px;\\\">Password:</span>roni_cost3@example.com</p>\\n</div>\",\"creation_time\":\"2020-11-01 21:13:57\",\"update_time\":\"2020-11-01 21:13:57\",\"active\":true,\"type\":\"cms_block\",\"tsk\":1604285724877},\"doc\":{\"store_id\":[0],\"id\":18,\"identifier\":\"login-data\",\"title\":\"Login Info Block\",\"content\":\"<div class=\\\"message info\\\" style=\\\"margin-top: 50px;\\\">\\n    <p><strong>Try Demo Customer Access</strong></p>\\n    <p><span style=\\\"display:inline-block; width: 80px; padding-right: 10px;\\\">Email:</span>roni_cost@example.com</p>\\n    <p><span style=\\\"display:inline-block; width: 80px; padding-right: 10px;\\\">Password:</span>roni_cost3@example.com</p>\\n</div>\",\"creation_time\":\"2020-11-01 21:13:57\",\"update_time\":\"2020-11-01 21:13:57\",\"active\":true,\"type\":\"cms_block\",\"tsk\":1604285724877}}","statusCode":400,"response":"{\"error\":{\"root_cause\":[{\"type\":\"illegal_argument_exception\",\"reason\":\"Rejecting mapping update to [vue_storefront_catalog] as the final mapping would have more than 1 type: [category, cms_block]\"}],\"type\":\"illegal_argument_exception\",\"reason\":\"Rejecting mapping update to [vue_storefront_catalog] as the final mapping would have more than 1 type: [category, cms_block]\"},\"status\":400}"} date=Mon Nov 02 2020 02:55:25 GMT+0000 (Greenwich Mean Time), ..., stack=[Error: [illegal_argument_exception] Rejecting mapping update to [vue_storefront_catalog] as the final mapping would have more than 1 type: [category, cms_block] :: {"path":"/vue_storefront_catalog/cms_block/18/_update","query":{},"body":"{\"upsert\":{\"store_id\":[0],\"id\":18,\"identifier\":\"login-data\",\"title\":\"Login Info Block\",\"content\":\"<div class=\\\"message info\\\" style=\\\"margin-top: 50px;\\\">\\n    <p><strong>Try Demo Customer Access</strong></p>\\n    <p><span style=\\\"display:inline-block; width: 80px; padding-right: 10px;\\\">Email:</span>roni_cost@example.com</p>\\n    <p><span style=\\\"display:inline-block; width: 80px; padding-right: 10px;\\\">Password:</span>roni_cost3@example.com</p>\\n</div>\",\"creation_time\":\"2020-11-01 21:13:57\",\"update_time\":\"2020-11-01 21:13:57\",\"active\":true,\"type\":\"cms_block\",\"tsk\":1604285724877},\"doc\":{\"store_id\":[0],\"id\":18,\"identifier\":\"login-data\",\"title\":\"Login Info Block\",\"content\":\"<div class=\\\"message info\\\" style=\\\"margin-top: 50px;\\\">\\n    <p><strong>Try Demo Customer Access</strong></p>\\n    <p><span style=\\\"display:inline-block; width: 80px; padding-right: 10px;\\\">Email:</span>roni_cost@example.com</p>\\n    <p><span style=\\\"display:inline-block; width: 80px; padding-right: 10px;\\\">Password:</span>roni_cost3@example.com</p>\\n</div>\",\"creation_time\":\"2020-11-01 21:13:57\",\"update_time\":\"2020-11-01 21:13:57\",\"active\":true,\"type\":\"cms_block\",\"tsk\":1604285724877}}","statusCode":400,"response":"{\"error\":{\"root_cause\":[{\"type\":\"illegal_argument_exception\",\"reason\":\"Rejecting mapping update to [vue_storefront_catalog] as the final mapping would have more than 1 type: [category, cms_block]\"}],\"type\":\"illegal_argument_exception\",\"reason\":\"Rejecting mapping update to [vue_storefront_catalog] as the final mapping would have more than 1 type: [category, cms_block]\"},\"status\":400}"},...]

Expected behavior

Records should be imported into ES without any errors.

Steps to reproduce the issue

  1. Get a fresh Magento 2.4.1 installation with sample data.
  2. Use the latest develop branch from storefront ui and add integration details.
  3. Run yarn mage2vs import

Repository

N/A

Can you handle fixing this bug by yourself?

  • YES
  • NO

Environment details

  • Browser: N/A
  • OS: Mac OS Catalina 10.15.7
  • Node: 12.18.3
  • Code Version: develop

Additional information

This seems related to changes to ES6+ where mapping types were removed so index can only have 1 type.

https://www.elastic.co/guide/en/elasticsearch/reference/6.0/removal-of-types.html

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions