2

I am running Magento 2.3 and set up elastic search 5.0+ which works fine on most pages but in some, including layered navigation search results I get the following error:

1 exception(s):
Exception #0 (Exception): Notice: Undefined index: color_bucket in 
/home/tthh/public_html/vendor/magento/module- 
elasticsearch/SearchAdapter/Aggregation/Builder/Term.php on line 23

I've looked in Term.php and this is line 23:

foreach ($queryResult['aggregations'][$bucket->getName()]['buckets'] as 
$resultBucket) {

Lastly, with elastic search enabled, I randomly now cannot press on any of the layered navigation (shop by) choices, an ajax gif shows up but the results do not change.

Changing back to MySQL search works fine.

Any insight into sorting this would be appreciated.

3

Same problem here with a different attribute: Exception #0 (Exception): Notice: Undefined index: belastbarkeit_bucket in /var/www/public/vendor/magento/module-elasticsearch/SearchAdapter/Aggregation/Builder/Term.php on line 23

UPDATE: I found this not to be a problem in Magento, but in Elastic-Search. In order to upgrade our shop from Magento 2.2.6 to 2.2.7 (and later 2.3) we manually had to create a "manufacturer" attribute, as described here Magento 2.2.6 - Attribute with ID "Manufacturer" does not exist This attribute caused Elasticsearch to throw an exception because "manufacturer" was created as a text-field and fielddata is disabled on text-fields by default. The solution for us was to disable Search for the manufacturer-attribute ("Use in Search" => "No") in the Magento-Backend.

  • I only yesterday found out that it was caused by a module that was part of the theme, they included a layered navigation which they had updated, disabling it fixed the problem and I was still able to get the speed Elastic-Search offered. Your fix is duly noted though and I will try that by enabling the module again. The theme developer would appreciate knowing that if it sorts it. Thanks! – Mehdi Rafiai Jan 8 at 19:39
1

Turned out is filterable of the attributes. Need to turn some of them off.

enter image description here

enter image description here

0

It might be some attribute front-end type text used for search layernavigation. In layernavigation only multiple, select or price attribute can be used.

So run this query to find those attributes

SELECT ea.attribute_code, ea.frontend_input, cea.is_filterable,   cea.is_filterable_in_search FROM eav_attribute AS ea
 INNER JOIN catalog_eav_attribute AS cea ON ea.attribute_id = cea.`attribute_id`
 WHERE (is_filterable = 1 OR is_filterable_in_search = 1) AND frontend_input NOT IN ('multiselect', 'select', 'price');

If this query fetch results then run following query to fix issue

UPDATE catalog_eav_attribute AS cea
INNER JOIN eav_attribute AS ea
    ON ea.attribute_id = cea.attribute_id
SET cea.is_filterable = 0, cea.is_filterable_in_search = 0
WHERE (cea.is_filterable = 1 OR cea.is_filterable_in_search = 1) 
AND frontend_input NOT IN ('multiselect', 'select', 'price');

Run bin/magento indexer:reindex catalogsearch_fulltext Run bin/magento c:f

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.