0

I've recently upgraded my Magento 2 store from version 2.4.1 to 2.4.3.

However, I'm encountering issues when running the catalog search, And I'm receiving the following error message:

main.CRITICAL: {"error":{"root_cause":[{"type":"illegal_argument_exception","reason":"Rejecting mapping update to [magento2_product_1_v2] as the final mapping would have more than 1 type: [_doc, document]"}],"type":"illegal_argument_exception","reason":"Rejecting mapping update to [magento2_product_1_v2] as the final mapping would have more than 1 type: [_doc, document]"},"status":400} {"exception":"[object] (Elasticsearch\Common\Exceptions\BadRequest400Exception(code: 400): {"error":{"root_cause":[{"type":"illegal_argument_exception","reason":"Rejecting mapping update to [magento2_product_1_v2] as the final mapping would have more than 1 type: [_doc, document]"}],"type":"illegal_argument_exception","reason":"Rejecting mapping update to [magento2_product_1_v2] as the final mapping would have more than 1 type: [_doc, document]"},"status":400} at /var/www/html/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Connections/Connection.php:675)"} []

I've consulted the official documentation, And it indicates that Magento 2.4.3 is compatible with Elasticsearch version 7.10. I'm using Elasticsearch 7.10 with Magento 2.4.3.

Despite this, I'm facing indexing issues.

Could you please provide guidance/solution on how to resolve this issue?

Your assistance would be greatly appreciated.

Ronak Rathod
  • 6,322
  • 17
  • 42
Zeck
  • 3
  • 3

3 Answers3

0

You can use the Elasticsearch REST API for this like Kibana to inspect your indexes.

Then you can check the version in the Elasticsearchtemplate . This problem is due to Index Template issue in Elasticsearch you can follow the below link to update the indexes :

https://discuss.elastic.co/t/rejecting-mapping-update-to-xxx-as-the-final-mapping-would-have-more-than-1-type-doc-xxx/298839/11

Grazitti Dev
  • 520
  • 1
  • 11
0

Try This

You can check this solution where you need to update two settings in your elasticsearch.

curl -XPUT -H "Content-Type: application/json" http://localhost:9200/_cluster/settings -d '{ "transient": { "cluster.routing.allocation.disk.threshold_enabled": false } }'

curl -XPUT -H "Content-Type: application/json" http://localhost:9200/_all/_settings -d '{"index.blocks.read_only_allow_delete": null}'

For More: https://www.appsloveworld.com/magentocdng/219/elasticsearch-badrequest400exception-error-main-critical-quoterrorquot?expand_article=1

Other Solutions

  1. Magento 2.4 Elastic search error: Text fields are not optimised for operations

  2. Magento 2.x Elasticsearch Category Products Not Showing

Msquare
  • 9,063
  • 7
  • 25
  • 63
  • Thanks for helping, could you please describe how to change prefix for each store? The field "Elasticsearch Index Prefix" is available only when the Scope is "default config" When I switch to Store (I have to 4) the field is not available at all.

    Please help. Thank you.

    – Zeck Sep 26 '23 at 04:14
  • @Msquare it is not correct. Elasticsearch prefix is a global scope setting. It cannot be set different for each store. – Afreen Sheikh Sep 26 '23 at 10:23
  • 1
    @AfreenSheikh I updated the answer. Thanks for your kind information. – Msquare Sep 26 '23 at 11:10
  • Thank for helping guys, it's not working. When i run first command I get following info {"acknowledged":true,"persistent":{},"transient":{"cluster":{"routing":{"allocation":{"disk":{"threshold_enabled":"false"}}}}}} and the second command i get {"acknowledged":true}. But when I run indexer error is still same – Zeck Sep 27 '23 at 00:57
  • Should I restart my ES cluster? – Zeck Sep 27 '23 at 01:00
  • Here is the full errors: Catalog Search index process error during indexation process: {"error":{"root_cause":[{"type":"illegal_argument_exception","reason":"Rejecting mapping update to [eshop_product_1_v2] as the final mapping would have more than 1 type: [_doc, document]"}],"type":"illegal_argument_exception","reason":"Rejecting mapping update to [eshop_product_1_v2] as the final mapping would have more than 1 type: [_doc, document]"},"status":400} – Zeck Sep 27 '23 at 01:01
0

I think in your case it's just a configuration issue as during upgrade sometimes search engine doesn't update on all places required and sometimes gets locked up in environment variables as well.

Run following command to confirm whether your search engine is set to elasticsearch7

php bin/magento config:show catalog/search/engine

If it is elasticsearch6 or something else or even if it is elasticsearch 7, run following command

php bin/magento --lock-env config:set  catalog/search/engine elasticsearch7

Above command will also set the elasticsearch version in env as well.

Try above things and if it doesn't work I have a few more ideas which may be causing this issue.

Vivek Kumar
  • 5,115
  • 2
  • 24
  • 50