2

Following Error logs in exception.log file:

main.CRITICAL: {"error":{"root_cause":[{"type":"illegal_argument_exception","reason":"Text fields are not optimised for operations that require per-document field data like aggregations and sorting, so these operations are disabled by default. Please use a keyword field instead. Alternatively, set fielddata=true on [gift_price] in order to load field data by uninverting the inverted index. Note that this can use significant memory."}],"type":"search_phase_execution_exception","reason":"all shards failed","phase":"query","grouped":true,"failed_shards":[{"shard":0,"index":"toplinem2_product_5_v19","node":"_emcfzugRbWjAjzCgv265Q"

3 Answers 3

7

on Investigation came to know this issue is due to upgrade process. Some product attributes which are text/varchar set to be filerable in search. like for me gift_price mentioned in above error. So you need to search those in your DB and change their statuses. I use the following queries to fix those issues:

First you can find those attributes to look them:

select * from xb_catalog_eav_attribute WHERE is_filterable_in_search = 1 and attribute_id IN (SELECT attribute_id FROM xb_eav_attribute WHERE entity_type_id = 4 AND backend_type = 'varchar')

Then you can run the following query:

UPDATE xb_catalog_eav_attribute 
SET is_filterable_in_search = 0 
WHERE attribute_id IN (SELECT attribute_id FROM xb_eav_attribute WHERE entity_type_id = 4 AND backend_type = 'varchar')

In my case gift_price this attribute is just appearing into error logs so I search this as well by following query:

SELECT * FROM evonomix_toplinem2_local.xb_eav_attribute where attribute_code = "gift_price";

and get its id then run following to mark it non filterable:

UPDATE xb_catalog_eav_attribute SET is_filterable_in_search = 0 WHERE attribute_id IN (695)

Purpose of all this explanation is to give brief on this issue and starting point to debuging for your similar issues.

3
  • Combining your answer with this, I finally traced and fixed the same error: magento.stackexchange.com/questions/299668/… Sep 20, 2021 at 13:27
  • Thanks for this mate!! :) This is working. I had the same issue with gift_price Sep 22, 2021 at 1:39
  • It works, thank you! Just a note that on my side, I had to do "bin/magento cache:clean" after that to have the change applied. I thought that it is DB related and not required but it was not the case
    – Duc To
    Mar 8 at 3:26
1

That works fine, but in my case catalog_product entity_type_id was 10 and also there was some text type attributes set to is_filterable_in_search = 1.

So modified query as following:

First take database backup & run query to verify records

SELECT * from catalog_eav_attribute WHERE is_filterable_in_search = 1 and attribute_id IN (SELECT attribute_id FROM eav_attribute WHERE entity_type_id IN (SELECT entity_type_id FROM `eav_entity_type` WHERE `entity_type_code` = 'catalog_product') AND (backend_type = 'varchar' OR backend_type = 'text'));

Run the update query:

UPDATE catalog_eav_attribute SET is_filterable_in_search = 0 WHERE attribute_id IN (SELECT attribute_id FROM eav_attribute WHERE entity_type_id IN (SELECT entity_type_id FROM `eav_entity_type` WHERE `entity_type_code` = 'catalog_product') AND (backend_type = 'varchar' OR backend_type = 'text'));

That's all.

Cheers!

0

I am upgrading from 2.3.3 to 2.4.4, and I would like to add to the answers from @hassan-ali-shahzad and @rohit-prajapati that not only is_filterable_in_search but also is_filterable causes problems.

Below I've added the attribute to the SQL from @rohit-prajapati that will show all the problematic attributes.

SELECT * from catalog_eav_attribute WHERE (is_filterable_in_search = 1 OR is_filterable = 1) AND attribute_id IN (SELECT attribute_id FROM eav_attribute WHERE entity_type_id IN (SELECT entity_type_id FROM `eav_entity_type` WHERE `entity_type_code` = 'catalog_product') AND (backend_type = 'varchar' OR backend_type = 'text'));

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.