7

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"

5 Answers 5

9

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, 2022 at 3:26
4

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'));
1
  • 1
    This worked for me! Here is the query I ran to fix it: update catalog_eav_attribute set is_filterable=0, is_filterable_in_search=0 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")); Sep 16, 2022 at 16:35
2

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
update catalog_eav_attribute set is_filterable=0, is_filterable_in_search=0 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"));

MySQL update query worked for me.

0

I've made a custom product attribute by adding this code:

$eavSetup->addAttribute(
    Product::ENTITY,
    'my_custom_attribute',
    [
        'type' => 'varchar',
        'backend' => '',
        'frontend' => '',
        'label' => 'My custom label',
        'input' => 'text',
        'class' => '',
        'group' => 'Product Details',
        'global' => ScopedAttributeInterface::SCOPE_STORE,
        'visible' => true,
        'required' => false,
        'user_defined' => true,
        'default' => '',
        'searchable' => true,
        'filterable' => true,
        'comparable' => true,
        'visible_on_front' => false,
        'used_in_product_listing' => false,
        'unique' => false,
        'source' => '',
        'is_used_in_grid' => true,
        'is_visible_in_grid' => true,
        'is_filterable_in_grid' => true,
        'apply_to' => 'booking' 
    ]
);

I went to the category page and I got no products , in the logs I've got the same as Hassan Ali Shahzad mentioned.

The fix for me was to update this field to NO: enter image description here

Probably if I would change the: 'searchable' => true, to 'searchable' => false,, would worked as well.

Maybe this post will help someone in the future.

Cheers !

Your Answer

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

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