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.

6
  • can you please try to change the indexer name in the elastic search setting then try? Sep 23 at 19:11
  • I tried but it's not work. The error is same
    – Zeck
    Sep 25 at 3:28
  • Were you using elasticsearch 6.x during your previous installation? Sep 26 at 13:14
  • Please see my reply
    – Zeck
    Sep 27 at 2:41
  • just check your jdk version with respect to that elasticsearch version
    – Pramod
    Sep 28 at 12:57

3 Answers 3

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

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

6
  • 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 at 4:14
  • @Msquare it is not correct. Elasticsearch prefix is a global scope setting. It cannot be set different for each store. Sep 26 at 10:23
  • 1
    @AfreenSheikh I updated the answer. Thanks for your kind information.
    – Msquare
    Sep 26 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 at 0:57
  • Should I restart my ES cluster?
    – Zeck
    Sep 27 at 1:00
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.

3
  • Result is same. I run above command and run bin/magento setup:di:compile, restart apache and result is same.
    – Zeck
    Sep 27 at 2:13
  • Did you get elasticsearch7 when youi ran config:show command? Sep 27 at 4:36
  • Yes it was ES 7.
    – Zeck
    Sep 27 at 5:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.