Magento2 搜索引擎ElasticSearch的安装

2018-11-19 13:13:50   Magento

  Magento 2   ElasticSearch  

ElasticSearch 6.x Search Engine Wiki


ElasticSearch Server 安装步骤

1.安装jre环境

• Debian/Ubuntu/Other APT based distros :

  1. sudo apt-get install openjdk-8-jre

2.安装ElasticSearch

• Install via APT

  1. wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -
  2. sudo apt-get install apt-transport-https
  3. echo "deb https://artifacts.elastic.co/packages/6.x/apt stable main" | sudo tee -a /etc/apt/sources.list.d/elastic-6.x.list

安装

  1. sudo apt-get update && sudo apt-get install elasticsearch

3.启动ElastivSearch

先给个权限

  1. sudo chmod 777 /var/log/elasticsearch/*
  2. sudo service elasticsearch start

测试是否启动成功

  1. curl localhost:9200

4.查看安装目录

  1. curl "localhost:9200/_nodes/settings?pretty=true"

5.进入安装目录

  1. cd /usr/share/elasticsearch

6.安装插件

  1. bin/elasticsearch-plugin install analysis-phonetic
  2. bin/elasticsearch-plugin install analysis-icu

7.重启Elastivserach

  1. sudo service elasticsearch restart

ElasticSearch Module 安装步骤

1. Composer 安装

  1. composer require smile/elasticsuite

2. 启用module并且运行ElasticSuite

  1. bin/magento module:enable Smile_ElasticsuiteCore Smile_ElasticsuiteCatalog Smile_ElasticsuiteSwatches Smile_ElasticsuiteCatalogRule Smile_ElasticsuiteVirtualCategory Smile_ElasticsuiteThesaurus Smile_ElasticsuiteCatalogOptimizer Smile_ElasticsuiteTracker

3. 配置ElasticSuite

  1. bin/magento config:set -l smile_elasticsuite_core_base_settings/es_client/servers localhost:9200
  2. bin/magento config:set -l smile_elasticsuite_core_base_settings/es_client/enable_https_mode 0
  3. bin/magento config:set -l smile_elasticsuite_core_base_settings/es_client/enable_http_auth 0
  4. bin/magento config:set -l smile_elasticsuite_core_base_settings/es_client/http_auth_user ""
  5. bin/magento config:set -l smile_elasticsuite_core_base_settings/es_client/http_auth_pwd ""
  6. bin/magento app:config:import

4. 运行index

  1. bin/magento index:reindex catalogsearch_fulltext
  2. bin/magento index:reindex elasticsuite_categories_fulltext
  3. bin/magento index:reindex elasticsuite_thesaurus

Install Server Guide
https://github.com/Smile-SA/elasticsuite/wiki/ServerConfig-6.x
Magento 2 Module Install
https://github.com/Smile-SA/elasticsuite/wiki/ModuleInstall