3

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.

3
  • are you still facing this issue? I was wondering whether you found any solution? I have the problem...Thanks.
    – Viktor
    Dec 29, 2020 at 11:08
  • Yes, it’s happening when you have multiple magento websites on the same server. You need to specify a different elastic search index name for each website. Go to Stores/Configuration/Catalog/Catalog/ Elastic index prefix - and specify a different index name for each website. Then reindex each store and it will work. Dec 30, 2020 at 12:05
  • Try searching for "position_category_12" in your custom code. This is related to Toolbar options I believe. You might have some custom toolbar sorting. Aug 18, 2021 at 19:11

3 Answers 3

4

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

1
  • 4
    If bin/magento indexer:reindex doesn't solve the issue then. Please bin/magento indexer:reset then bin/magento indexer:reindex Aug 9, 2021 at 11:07
-1

I solved this problem by changing sorting in categories by "Name". And i saw that somebody fix this by changing prefix, but it's global https://prnt.sc/whqf1p

-1

We have the same issue and have not been able to find a solution for this anywhere. It is such a strange error. We have ElasticSearch7 installed with Magento 2.3.5pt-2 and we get very similar error.

Running bin/magento indexer:reindex is only a temporary fix and not a solution to the problem. Error will come back and products disappear on frontend of site.

main.CRITICAL: {"error":{"root_cause":[{"type":"query_shard_exception","reason":"No mapping found for [news_to_date.sort_news_to_date] in order to sort on","index_uuid":"v6RZUm3kQEugC3aecGVp1Q","index":"magento2live_webpos_productsearch_fulltext_1_v17"}],"type":"search_phase_execution_exception","reason":"all shards failed","phase":"query","grouped":true,"failed_shards":[{"shard":0,"index":"magento2live_webpos_productsearch_fulltext_1_v17","node":"Ml8-bmNiSkqu5yLzk8on9g","reason":{"type":"query_shard_exception","reason":"No mapping found for [news_to_date.sort_news_to_date] in order to sort on","index_uuid":"v6RZUm3kQEugC3aecGVp1Q","index":"magento2live_webpos_productsearch_fulltext_1_v17"}}]},"status":400} {"exception":"[object] (Elasticsearch\\Common\\Exceptions\\BadRequest400Exception(code: 400): {\"error\":{\"root_cause\":[{\"type\":\"query_shard_exception\",\"reason\":\"No mapping found for [news_to_date.sort_news_to_date] in order to sort on\",\"index_uuid\":\"v6RZUm3kQEugC3aecGVp1Q\",\"index\":\"magento2live_webpos_productsearch_fulltext_1_v17\"}],\"type\":\"search_phase_execution_exception\",\"reason\":\"all shards failed\",\"phase\":\"query\",\"grouped\":true,\"failed_shards\":[{\"shard\":0,\"index\":\"magento2live_webpos_productsearch_fulltext_1_v17\",\"node\":\"Ml8-bmNiSkqu5yLzk8on9g\",\"reason\":{\"type\":\"query_shard_exception\",\"reason\":\"No mapping found for [news_to_date.sort_news_to_date] in order to sort on\",\"index_uuid\":\"v6RZUm3kQEugC3aecGVp1Q\",\"index\":\"magento2live_webpos_productsearch_fulltext_1_v17\"}}]},\"status\":400} at /var/www/vhosts/upperlimitsinc.com/httpdocs/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Connections/Connection.php:641)"} []
1
  • After updating to Magento2.4.2pt-1. We do not receive this error anymore.
    – Jonathan
    Oct 28, 2021 at 18:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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