在Magento2.3.5中使用Elasticsearch
首先
为了输入样本数据,故意安装了旧版本的Magento,但V2.3.5中的搜索引擎是MySql。现在将其更改为ElasticSearch。
编辑/etc/elasticsearch/elasticsearch.yml文件
然后,将重新启动elasticsearch。顺便提一下,elasticsearch的日志位于/var/log/elasticsearch/目录下。
sudo systemctl daemon-reload
sudo systemctl restart elasticsearch.service
修改Magento的设置
引擎的设置位于商店 – 配置 – 目录 – 目录搜索中。
取消“使用系统值”选项,选择Elasticsearch。
我們將使用此按鈕進行連接測試。
只要出现以下显示,连接确认OK。
保存配置。
由于只有这个命令,不会有任何输出,所以重新创建缓存和索引。
$ bin/magento indexer:reindex
Design Config Grid index has been rebuilt successfully in 00:00:00
Customer Grid index has been rebuilt successfully in 00:00:00
Category Products index has been rebuilt successfully in 00:00:00
Product Categories index has been rebuilt successfully in 00:00:00
Catalog Rule Product index has been rebuilt successfully in 00:00:00
Product EAV index has been rebuilt successfully in 00:00:01
Stock index has been rebuilt successfully in 00:00:00
Inventory index has been rebuilt successfully in 00:00:00
Catalog Product Rule index has been rebuilt successfully in 00:00:00
Product Price index has been rebuilt successfully in 00:00:01
Google Product Removal Feed index has been rebuilt successfully in 00:00:00
Google Product Feed index has been rebuilt successfully in 00:00:00
Catalog Search index has been rebuilt successfully in 00:00:02
$ bin/magento cache:flush
Flushed cache types:
config
layout
block_html
collections
reflection
db_ddl
compiled_config
eav
customer_notification
config_integration
config_integration_api
google_product
full_page
config_webservice
translate
vertex
结束了。