chameleon-system/elasticsearch-bundle

This package is abandoned and no longer maintained. The author suggests using the chameleon-system-private/elasticsearch-bundle package instead.

Connects Chameleon to ElasticSearch


README

Step 1: Download the Bundle

Open a command console, enter your project directory and execute the following command to download the latest stable version of this bundle:

$ composer require chameleon-system/elasticsearch-bundle "dev-master"

This command requires you to have Composer installed globally, as explained in the installation chapter of the Composer documentation.

Step 2: Enable the Bundle

Then, enable the bundle by adding the following line in the app/AppKernel.php file of your project:

<?php
// app/AppKernel.php

// ...

public function registerBundles()
{
    $bundles = array(
        // ...
        new \ONGR\ElasticsearchBundle\ONGRElasticsearchBundle(),
        new \ChameleonSystem\ElasticSearchBundle\ChameleonSystemElasticsearchBundle()
    );
}

Step 3: Create and fill index

Create an index (that's like a database in MySQL) using the ongr bundle (see command.md in ongr-io/ElasticsearchBundle docs linked below)

app/console es:index:create

Fill an index using the proof of concept command

app/console ch:esindex:fill

Step 4: RTFM

Bird's eye view: Create Index, Add Documents, Retrieve Documents, Search easily from within your Symfony2 environment:

https://github.com/ongr-io/ElasticsearchBundle/tree/master/Resources/doc

In depth knowledge in the elasticsearch book:

http://www.elasticsearch.org/guide/en/elasticsearch/guide/current/

Add Custom Fields to Index

To add custom fields, you need to modify the mapping and you need to extract the data from the shop article.

The first can be done by implementing \ChameleonSystem\ElasticsearchBundle\Interfaces\IndexMappingModifierInterface, creating a service for the implementation and tagging it with chameleon_system.elasticsearch_mapping_modifier.

To add data from the shop article to your index, you then need to implement \ChameleonSystem\ElasticsearchBundle\Interfaces\ShopArticleToElasticSearchIndexDataMapperInterface. Create a service for the implementation and tag it with chameleon_system.elasticsearch_data_mapper.