LoginSignup
0
0

More than 1 year has passed since last update.

Magento2.3.5でElasticsearchを使用する

Posted at

初めに

サンプルデータを入れるためにあえて古いバージョンを入れたMagentoですが、V2.3.5では検索エンジンがMySqlでした。これをElasticSearchに変更します。

/etc/elasticsearch/elasticsearch.ymlの編集

赤線部分(clust)をnode.nameで定義した My First Node に変更します。
image.png

その後、elasticsearchを再起動します。ちなみにelasticsearchのログは/var/log/elasticsearch/の下にあります。

sudo systemctl daemon-reload
sudo systemctl restart elasticsearch.service

Magento側の設定変更

エンジンの設定はStores - Configuration - Catalog - Catalog Searchの中にあります。

Use system valueのチェックを外しElasticsearchを選択します。

image.png

このボタンで接続確認を行います。

image.png

以下の表示が出れば接続確認OKです。

image.png

Save Configします。

image.png

これだけだと何も出力されないので、キャッシュとインデックスを作り直します。

$ 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

おしまい。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0