Solved: Magento 2.4.x Elastic Search Error: Text Fields are Not Optimised for Operations
Hello Magento pals π
Ever faced an error in Magento that says: “Text Fields are Not Optimised for Operations”?
Magento continuously releases regular updates that add amazing features and enhance the store’s performance. However, sometimes these upgrades also come with some technical bugs that can hamper the store’s performance. One such elastic search bug in the Magento 2.4 release line is causing issues on the product category page. Many of the store owners reported the products aren’t loaded on the category page and the following error in the exception.log file is generated:
“Text fields are not optimized 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.”
In this blog post, I will provide a complete solution to solve this issue in Magento 2.4.x.
Method to Solve Magento 2.4.x Elastic Search Error: Text Fields are Not Optimised for Operations
In Magento 2.4.x, the product listing issue on the category page or the ‘Text fields are not optimized for operations’ error is caused when a varchar or text field is set to filterable in elastic search. This can be solved by finding the error-causing attribute and disabling the filterable in search for that attribute.
You can run the following query to find those attributes:
1 |
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 = 4 AND backend_type = 'varchar') |
Running the above query will list down all the varchar attributes that are set to ‘filterable in search’.
Once you find the attributes that are causing the ‘Text Fields are Not Optimized for Operations’ issue, you can disable them using the following query:
1 |
UPDATE catalog_eav_attribute SET is_filterable_in_search = 0 WHERE attribute_id IN (SELECT attribute_id FROM eav_attribute WHERE entity_type_id = 4 AND backend_type = 'varchar') |
Thatβs it.
Recently I posted a solution to cluster block exception in Magento 2, which you may also love to read. You can also configure Elasticsearch in Magento 2 to use its features like an open-source, readily-scalable, analytics, broadly-distributable, etc.
If you have any doubts or queries, please feel free to comment. Iβd be happy to help you. π
Also, Iβd be grateful if you could share the solution with the Magento community via social media. π
Thank you. π
Also read:
Prev
Solved: Admin Login Not Working After Upgrading to Magento 2.4.4
6 Benefits of SEO Services For Shopify Stores [2024]
Next