• Home
  • Nous contacter

Le blog d'Adfab

Le blog d'Adfab

Le blog d'Adfab

Le blog d'Adfab
e-Commerce

Elasticsearch pour Magento –> Elasticsearch for Magento

Aujourd’hui nous allons implementer elasticsearch pour remplacer le moteur de recherche natif de Magento.

Une première partie concernera la partie installation et configuration du module Magento. La deuxième partie traitera de l’installation coté serveur debian.

Pourquoi Elasticsearch?

La problématique qui s’est posée à nous était la suivante : « Nous souhaitons une pondération sur les champs de recherche. Le nom du produit doit avoir un poids supérieur à celui de la description du produit dans l’ordre d’affichage des produits dans la page de résultats de recherche ».

Le module elasticsearch permet la pondération sur les attributs Magento!

2ème Partie : Installation du moteur sur serveur *nix

Pre requis

  • Jdk version6 installé minimum

Vérifier avec la commande java -version qui doit vous retourner

java version "1.6.0_26"
Java(TM) SE Runtime Environment (build 1.6.0_26-b03)
Java HotSpot(TM) 64-Bit Server VM (build 20.1-b02, mixed mode)

  • curl

Vérifier avec la commande curl qui doit vous retourner

curl: try 'curl --help' or 'curl --manual' for more information

Ajout du dépôt

Pour des questions de maintenabilité et de mise à jour de sécurité des paquets il est toujours préférable de choisir un dépôt officiel apt. L’equipe d’ elasticsearch fait bien les choses car ils disposent d’un depot pour l’utilitaire apt.

  • Télécharger et installer la public key du dépôt.

wget -O - http://packages.elasticsearch.org/GPG-KEY-elasticsearch | apt-key add -

  • Ajouter la ligne ci-dessous à votre fichier /etc/apt/sources.list pour activer le dépot

deb http://packages.elasticsearch.org/elasticsearch/1.0/debian stable main

Installation

  • Lancer apt-get update pour mise à jour des dépots
  • Lancer apt-get install elasticsearch pour installation
    • Le paquet créé un nouveau user elasticsearch, un nouveau groupe elasticsearch

A la fin de l’installation elasticsearch n’est pas lancé.

Vérification du bon fonctionnement

Pour lancer elasticsearch, taper la commande

sudo /etc/init.d/elasticsearch start

Par défaut le moteur est monté sur le port 9200. Il y a évidement possibilité de le changer dans le fichier de conf /etc/elasticsearch/elasticsearch.yml

Pour vérifier, taper la commande

curl -X GET http://localhost:9200/

Le retour doit être un format json

{
"status" : 200,
"name" : "Barnacle",
"version" : {
"number" : "1.0.2",
"build_hash" : "4fc0da7f4473021f274d4bc8e1f9e90fd3b4f55a",
"build_timestamp" : "2014-03-25T15:41:15Z",
"build_snapshot" : false,
"lucene_version" : "4.6"
},
"tagline" : "You Know, for Search"
}

Et voilà…

 

ENGLISH

Today we’ll replace native magento search engine by elasticsearch.

The first part will show you how to install and setup the magento module then how to install elasticsearch engine on debian server in the second part.

Why Elasticsearch?

The problem that arose to us was :  « We want a weighting on Magento search fields. Product name weighting must be higher than the product description in the product display order on  search results page »

Elascticsearch module allows weighting on Magento product attributes!

2ème Partie : Elasticsearch engine installtion on *nix server

Pre requisite

  • Jdk version6 installed at least

please verify with this command java -version response should be

java version "1.6.0_26"
Java(TM) SE Runtime Environment (build 1.6.0_26-b03)
Java HotSpot(TM) 64-Bit Server VM (build 20.1-b02, mixed mode)

  • curl

please verify with this command curl response should be

curl: try 'curl --help' or 'curl --manual' for more information

Adding repository

It is always better to choose an official apt repository for maintainability and security matters. Elasticsearch‘s team does things nicely as they provide a offical one. Let’s add it to our server!

  • Download and install the repository public key

wget -O - http://packages.elasticsearch.org/GPG-KEY-elasticsearch | apt-key add -

  • add line below on your /etc/apt/sources.list to activate the repository

deb http://packages.elasticsearch.org/elasticsearch/1.0/debian stable main

Installing

  • Run apt-get update for repository update
  • Run apt-get install elasticsearch for installation
    • Le paquet créé un nouveau user elasticsearch, un nouveau groupe elasticsearch

At the end of the install process elasticsearch is not running

Running and Verifiying

To run it, run the command

sudo /etc/init.d/elasticsearch start

It runs by default on port 9200. You can change by editing the config file /etc/elasticsearch/elasticsearch.yml

To verify, run the command below

curl -X GET http://localhost:9200/

In response you have a json format

{
"status" : 200,
"name" : "Barnacle",
"version" : {
"number" : "1.0.2",
"build_hash" : "4fc0da7f4473021f274d4bc8e1f9e90fd3b4f55a",
"build_timestamp" : "2014-03-25T15:41:15Z",
"build_snapshot" : false,
"lucene_version" : "4.6"
},
"tagline" : "You Know, for Search"
}

And done. Enjoy…

28/06/2015 33 MIN READ TAGS: Elasticsearch, Magento BY: Emmanuel GONZALEZ 0 COMMENT
SHARE
LIRE LA SUITE

Emmanuel GONZALEZ

Créer un package pour Composer avec Github et Packagist – Partie 2

Tip : Enlever jQuery

VOUS POURRIEZ AIMER

e-Commerce Créer un script shell dans Magento

e-Commerce L'actualité AdFab Magento : Outfit, animation de votre site e-commerce par vos clients.

CMS e-Commerce Prestashop 1.7, pourquoi pas…

e-Commerce Outils Magento plugin for NetBeans IDE (part. 2)

CMS e-Commerce Woocommerce : Ajouter des coûts administrables pour un produit

e-Commerce Importer des données e-commerce avec l’ETL Talend Open Studio

A propos d’Adfab

Nous sommes un studio de production digitales et d’innovation digitales au service des agences et des annonceurs
Nous recherchons le scintillement dans les regards et le plaisir de réalisations sur-performantes
Nous sommes techno-agnostiques
Nous sommes Adfab

Le blog d'Adfab
Copyright © 2018 Adfab Connect