M2奇葩问题:从M2.3升级到M2.4搜索无结果

作者:admi... 点击数: 0 收藏到会员中心
最后编辑时间: 2021-05-27 19:09

这个问题特别奇特!

发现过程:客户网站从2.3升级到2.4.2 p1版本,发现elasticsearch 正常,但是始终无法得到任何数据,重置并刷新索引也无效。

问题日志:

\"caused_by\":{\"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 [image_label] in order to load field data by uninverting the inverted index. Note that this can use significant memory.\"}}},\"status\":400} at /www/wwwroot/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Connections/Connection.php:632)"} []

因为客户这个站点是从M1升级过来的,一直无任何问题,本次升级到M2.4,PHP版本及其它均有所升级,一一排除问题所在

付费内容限时免费中...
  1. 测试并未发现elasticsearch 7.12版本不兼容2.4.2 P1版本

  2. 测试php版本无任何影响

  3. 数据库版本无任何影响

  4. 主题及所使用的搜索扩展mageworx SearchSuiteAutocomplete 无对此无任何影响

    估计的是搜索所使用的字段不符合要求,默认情况下,分层导航中只能使用某些类型的产品属性。它们是Yes/No, Dropdown, Multipleselect, 与Price。不能将任何其他类型的属性设置为“在分层导航中使用 ”。但是通过直接更改数据库中的is_filterableandis_filterable_in_search值来解决此限制是一种技术可能性。如果发生这种情况,并且将任何其他属性类型(如日期,文本等)设置为在分层导航中使用,则Elasticsearch 会引发异常。

    为确保这种情况,您需要找出是否Yes/No, Dropdown, Multipleselect, 与Price以外的其他任何属性被设置为用于分层导航中。

操作指南:

1. 备份数据库

2. 执行SQL语句

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

3. 重建索引

php bin/magento indexer:reindex catalogsearch_fulltext

4.删除所有缓存文件并重建缓存

php bin/magento cache:clean

内容说明:
如您需要转载本文请保留以下信息是对作者发文的支持与尊重:

M2奇葩问题:从M2.3升级到M2.4搜索无结果 来源于 https://www.magentola.com/news-read-221.html
上一篇:magento2 apache伪静态导致无法访问解决方案
下一篇:M2.X在windows机中安装出现报错Unable to apply data patch Magento\Theme\Setup\Patch\Data\RegisterThemes
相关内容
产品推荐