{"id":2111,"date":"2022-09-22T07:30:20","date_gmt":"2022-09-22T07:30:20","guid":{"rendered":"https:\/\/meetanshi.com\/blog\/magento-2-4-elastic-search-error-text-fields-are-not-optimised-for-operations\/"},"modified":"2025-10-03T13:04:59","modified_gmt":"2025-10-03T07:34:59","slug":"magento-2-4-elastic-search-error-text-fields-are-not-optimised-for-operations","status":"publish","type":"post","link":"https:\/\/meetanshi.com\/blog\/magento-2-4-elastic-search-error-text-fields-are-not-optimised-for-operations\/","title":{"rendered":"Solved: Magento 2.4.x Elastic Search Error: Text Fields are Not Optimised for Operations"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Hello Magento pals  <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Ever faced an error in Magento that says: <em><strong>&#8220;Text Fields are Not Optimised for Operations&#8221;<\/strong><\/em>?<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><a title=\"All About Magento\" href=\"https:\/\/business.adobe.com\/products\/magento\/magento-commerce.html\" target=\"_blank\" rel=\"noopener\">Magento<\/a> continuously releases regular updates that add amazing features and enhance the store&#8217;s performance. However, sometimes these upgrades also come with some technical bugs that can hamper the store&#8217;s performance. One such elastic search bug in the <a title=\"Magento 2.4 Release\" href=\"https:\/\/meetanshi.com\/blog\/magento-2-4-release\/\" target=\"_blank\" rel=\"noopener\">Magento 2.4 release<\/a> line is causing issues on the product category page. Many of the store owners reported the products aren&#8217;t loaded on the category page and the following error in the exception.log file is generated:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&#8220;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.&#8221;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In this blog post, I will provide a complete solution to solve this issue in Magento 2.4.x.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Method to Solve Magento 2.4.x Elastic Search Error: Text Fields are Not Optimised for Operations<\/strong><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">In Magento 2.4.x, the product listing issue on the category page or the &#8216;Text fields are not optimized for operations&#8217; 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.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">You can run the following query to find those attributes:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"sql\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">SELECT\n    cea.*\nFROM\n    catalog_eav_attribute cea\nJOIN\n    eav_attribute ea ON cea.attribute_id = ea.attribute_id\nWHERE\n    cea.is_filterable_in_search = 1\n    AND ea.entity_type_id = 4\n    AND ea.backend_type = 'varchar';<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Running the above query will list down all the varchar attributes that are set to &#8216;filterable in search&#8217;.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Once you find the attributes that are causing the &#8216;Text Fields are Not Optimized for Operations&#8217; issue, you can disable them using the following query:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"sql\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">UPDATE\n    catalog_eav_attribute cea\nJOIN\n    eav_attribute ea ON cea.attribute_id = ea.attribute_id\nSET\n    cea.is_filterable_in_search = 0\nWHERE\n    ea.entity_type_id = 4\n    AND ea.backend_type = 'varchar';<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">That\u2019s it.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Recently I posted a solution to <a title=\"Solved: Cluster Block Exception in Magento 2\" href=\"https:\/\/meetanshi.com\/blog\/cluster-block-exception-in-magento-2\/\" target=\"_blank\" rel=\"noopener\">cluster block exception in Magento 2<\/a>, which you may also love to read. You can also <a title=\"How to Configure Magento 2 Elasticsearch\" href=\"https:\/\/meetanshi.com\/blog\/configure-magento-2-elasticsearch\/\">configure Elasticsearch in Magento 2<\/a> to use its features like an open-source, readily-scalable, analytics, broadly-distributable, etc.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If you have any doubts or queries, please feel free to comment. I\u2019d be happy to help you.  <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Also, I\u2019d be grateful if you could share the solution with the Magento community via social media.  <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Thank you.  <\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Also read:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a title=\"Fixed: Product Details Missing in Order Confirmation Email After Upgrading to Magento 2.4.x\" href=\"https:\/\/meetanshi.com\/blog\/product-details-missing-in-order-confirmation-email-after-upgrading-to-magento-2-4-x\/\" target=\"_blank\" rel=\"noopener\">Fixed: Product Details Missing in Order Confirmation Email After Upgrading to Magento 2.4.x<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Hello Magento pals Ever faced an error in Magento that says: &#8220;Text Fields are Not Optimised for Operations&#8221;? Magento continuously releases regular updates that add&#8230;<\/p>\n","protected":false},"author":19,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[34],"tags":[],"class_list":["post-2111","post","type-post","status-publish","format-standard","hentry","category-magento"],"acf":[],"_links":{"self":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/2111","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/users\/19"}],"replies":[{"embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/comments?post=2111"}],"version-history":[{"count":2,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/2111\/revisions"}],"predecessor-version":[{"id":23075,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/2111\/revisions\/23075"}],"wp:attachment":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/media?parent=2111"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/categories?post=2111"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/tags?post=2111"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}