0

I've recently upgraded my Magento version 2.4 and set Elasticsearch as the catalog search option, testing the connection gives a success message but when I try to search on the site itself I get an error message:

1 exception(s):
Exception #0 (Elasticsearch\Common\Exceptions\BadRequest400Exception): {"error":{"root_cause":[{"type":"illegal_argument_exception","reason":"no mapping found for field [huuid]"}],"type":"search_phase_execution_exception","reason":"all shards failed","phase":"query","grouped":true,"failed_shards":[{"shard":0,"index":"magento2_product_1_v18","node":"r9_ZsNBiTqiP7FJDre9MmA","reason":{"type":"illegal_argument_exception","reason":"no mapping found for field [huuid]"}}],"caused_by":{"type":"illegal_argument_exception","reason":"no mapping found for field [huuid]","caused_by":{"type":"illegal_argument_exception","reason":"no mapping found for field [huuid]"}}},"status":400}

Exception #0 (Elasticsearch\Common\Exceptions\BadRequest400Exception): {"error":{"root_cause":[{"type":"illegal_argument_exception","reason":"no mapping found for field [huuid]"}],"type":"search_phase_execution_exception","reason":"all shards failed","phase":"query","grouped":true,"failed_shards":[{"shard":0,"index":"magento2_product_1_v18","node":"r9_ZsNBiTqiP7FJDre9MmA","reason":{"type":"illegal_argument_exception","reason":"no mapping found for field [huuid]"}}],"caused_by":{"type":"illegal_argument_exception","reason":"no mapping found for field [huuid]","caused_by":{"type":"illegal_argument_exception","reason":"no mapping found for field [huuid]"}}},"status":400}
<pre>#1 Elasticsearch\Connections\Connection->Elasticsearch\Connections\{closure}(array('transfer_stats' => array('url' => 'http://localhost...', 'content_type' => 'application/json...', 'http_code' => 400, 'header_size' => 241, 'request_size' => 9646, 'filetime' => -1, 'ssl_verify_resul...' => 0, 'redirect_count' => 0, 'total_time' => 0.001344, 'namelookup_time' => 2.0E-5, 'connect_time' => 2.0E-5, 'pretransfer_time' => 5.4E-5, 'size_upload' => 9421, 'size_download' => 605, 'speed_download' => 605000, 'speed_upload' => 9421000, 'download_content...' => 605, 'upload_content_l...' => 9421, 'starttransfer_ti...' => 0.001326, 'redirect_time' => 0, 'redirect_url' => '', 'primary_ip' => '::1', 'certinfo' => array(), 'primary_port' => 9200, 'local_ip' => '::1', 'local_port' => 38568, 'http_version' => 2, 'protocol' => 1, 'ssl_verifyresult' => 0, 'scheme' => 'HTTP', 'error' => '', 'errno' => 0), 'curl' => array('error' => '', 'errno' => 0), 'effective_url' => 'http://localhost...', 'headers' => array('Warning' => array('299 Elasticsearc...'), 'content-type' => array('application/json...'), 'content-length' => array(605)), 'version' => 1.1, 'status' => 400, 'reason' => 'Bad Request', 'body' => '{"error":{"root_...')) called at [vendor/react/promise/src/FulfilledPromise.php:28]
#2 React\Promise\FulfilledPromise->then(&Closure#000000002259009b0000000036d4a3c1#, NULL, NULL) called at [vendor/ezimuel/ringphp/src/Future/CompletedFutureValue.php:55]
#3 GuzzleHttp\Ring\Future\CompletedFutureValue->then(&Closure#000000002259009b0000000036d4a3c1#, NULL, NULL) called at [vendor/ezimuel/ringphp/src/Core.php:341]
#4 GuzzleHttp\Ring\Core::proxy(&GuzzleHttp\Ring\Future\CompletedFutureArray#00000000225900980000000036d4a3c1#, &Closure#000000002259009b0000000036d4a3c1#) called at [vendor/elasticsearch/elasticsearch/src/Elasticsearch/Connections/Connection.php:329]
#5 Elasticsearch\Connections\Connection->Elasticsearch\Connections\{closure}(array('http_method' => 'POST', 'scheme' => 'http', 'uri' => '/magento2_produc...', 'body' => '{"suggest":{"tex...', 'headers' => array('Host' => array('localhost'), 'Content-Type' => array('application/json'), 'Accept' => array('application/json'), 'User-Agent' => array('elasticsearch-ph...')), 'client' => array('port_in_header' => false, 'curl' => array(9200))), &Elasticsearch\Connections\Connection#00000000225901600000000036d4a3c1#, &Elasticsearch\Transport#00000000225901670000000036d4a3c1#, array()) called at [vendor/elasticsearch/elasticsearch/src/Elasticsearch/Connections/Connection.php:227]

Looking at the developer console it also gives the a 500 error:

GET https://websitename.com/catalogsearch/result/?q=%23Searchterm 500

I'm not entirely sure what is causing this problem. If anyone can offer any advice it would be greatly appreciated.

2
  • Make sure: Elastic search is running, configured with your server Commented Nov 2, 2021 at 15:59
  • Running "curl localhost:9200" returns version number 7.10.2. Running "ps aux | grep elasticsearch" returns values for elasticsearch and testing the connection is successful.
    – CJNotts
    Commented Nov 2, 2021 at 16:17

1 Answer 1

0

Apparently this was due to the SKU product attribute not being searchable.

I have now set modified the settings so that the value for searchable is "Yes" and this seems to have resolved this issue.

Your Answer

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

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