Magento – Magento 2.4.1 and Elasticsearch 7.6.2 “no mapping found” issue

elasticsearchmagento2.4

I'm facing an issue with a fresh install of Magento 2.4.1 and Elasticsearch 7.6.2.
The products appear for a moment, and I have to reindex again to see them.

The main issue appears to be "No mapping found for [position_category_xxxx] in order to sort on"

[2020-10-31 08:15:23] main.CRITICAL: {"error":{"root_cause":[{"type":"query_shard_exception","reason":"No mapping found for [position_category_12] in order to sort on","index_uuid":"AWmVw6XqQsikmOu6IfXvNg","index":"magento2_product_1_v4"}],"type":"search_phase_execution_exception","reason":"all shards failed","phase":"query","grouped":true,"failed_shards":[{"shard":0,"index":"magento2_product_1_v4","node":"2Nx7OzfeT8OB1JixlyNJng","reason":{"type":"query_shard_exception","reason":"No mapping found for [position_category_12] in order to sort on","index_uuid":"AWmVw6XqQsikmOu6IfXvNg","index":"magento2_product_1_v4"}}]},"status":400} {"exception":"[object] (Elasticsearch\\Common\\Exceptions\\BadRequest400Exception(code: 400): {\"error\":{\"root_cause\":[{\"type\":\"query_shard_exception\",\"reason\":\"No mapping found for [position_category_12] in order to sort on\",\"index_uuid\":\"AWmVw6XqQsikmOu6IfXvNg\",\"index\":\"magento2_product_1_v4\"}],\"type\":\"search_phase_execution_exception\",\"reason\":\"all shards failed\",\"phase\":\"query\",\"grouped\":true,\"failed_shards\":[{\"shard\":0,\"index\":\"magento2_product_1_v4\",\"node\":\"2Nx7OzfeT8OB1JixlyNJng\",\"reason\":{\"type\":\"query_shard_exception\",\"reason\":\"No mapping found for [position_category_12] in order to sort on\",\"index_uuid\":\"AWmVw6XqQsikmOu6IfXvNg\",\"index\":\"magento2_product_1_v4\"}}]},\"status\":400} at /var/www/vhosts/mywebsite.com/httpdocs/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Connections/Connection.php:632)"} []

It's a clean install without any extension or custom theme.
Elasticsearch is running on a Docker container / Plesk. (3 nodes cluster).
I have 4 Magento 2.4.1 websites on the server.

Best Answer

Run bin/magento indexer:reindex from your root directory folder.

Related Topic