Use Relevance without Elasticsearch
Introduction
Goal
Use Relevance without Elasticsearch at the expensive of giving up Trends and Experiments.
Background
In order to use the full functionality of the Relevance Module, Elasticsearch is required. However, as of Bloomreach Experience Manager 13.4.2, it is possible to use Relevance without Elasticsearch, at the expense of the Trends and Experiments functionalities.
In existing projects that were created using Bloomreach Experience Manager 13.4.1 or earlier, some manual steps are required to remove the Elasticsearch requirement. This page described those steps.
Prerequisites
The instructions below assume your implementation project was created using the Maven archetype, had Relevance added through Essentials, and has a platform properties configuration file (see HST Container Configuration for more details on platform properties).
Also, complete all running experiments and publish channel changes before you remove Elasticsearch from a production environment,
Remove ElasticSearch Requirement
In cms/src/main/webapp/WEB-INF/hst-config.properties), add the property:
targeting.elastic.disabled = true
The above makes Relevance run without ElasticSearch. The trade-off is that the Trends and Goals tabs is not available any more in the Content audiences application and that you cannot create or start an experiment any more in the Experience manager: the experiments feature is not available any more.
(Optional) Further Cleanup
Without the ElasticSearch requirement, more configuration can be removed from the project.
In conf/context.xml, the elasticsearch environment variable can be removed:
<Environment name="elasticsearch/targetingDS" value="{'indexName':'visits', 'locations':['http://localhost:9200/']}" type="java.lang.String"/>
For local development, the elasticsearch plugin can be removed from the root pom.xml so that it does not start any more with cargo.run. To achieve this, remove from the root pom.xml:
<plugin> <groupId>com.github.alexcojocaru</groupId> <artifactId>elasticsearch-maven-plugin</artifactId> <version>${maven.plugin.elasticsearch.version}</version> <executions> <execution> <id>start-elasticsearch</id> <phase>validate</phase> <goals> <goal>runforked</goal> </goals> </execution> <execution> <id>stop-elasticsearch</id> <phase>post-integration-test</phase> <goals> <goal>stop</goal> </goals> </execution> </executions> <configuration> <clusterName>esDevCluster</clusterName> <httpPort>${es.httpPort}</httpPort> <transportPort>${es.tcpPort}</transportPort> <version>${maven.plugin.elasticsearch.configuration.version}</version> <keepExistingData>true</keepExistingData> <timeout>60</timeout> <skip>${es.skip.start}</skip> </configuration> </plugin>
The Elasticsearch client dependencies can be excluded from hippo-addon-targeting-cms-dependencies (or hippo-addon-targeting-platform-dependencies if you use that one).
Replace
<dependency> <groupId>com.onehippo.cms7</groupId> <artifactId>hippo-addon-targeting-cms-dependencies</artifactId> <type>pom</type> </dependency>
with
<dependency> <groupId>com.onehippo.cms7</groupId> <artifactId>hippo-addon-targeting-cms-dependencies</artifactId> <type>pom</type> <exclusions> <exclusion> <groupId>com.onehippo.cms7</groupId> <artifactId>hippo-addon-targeting-state-elastic5</artifactId> </exclusion> <exclusion> <groupId>com.onehippo.cms7</groupId> <artifactId>hippo-addon-targeting-state-elastic6</artifactId> </exclusion> </exclusions> </dependency>
Optionally, remove the following configuration from the repository (although leaving it in place won't do any harm):
/targeting:targeting/targeting:datastores/targeting:visits
(Optional) Docker Cleanup
In case of using Docker, in addition to the actions above, execute the following steps:
1. Remove the following element from context-mysql.xml & context-postgres.xml:
<Environment name="elasticsearch/targetingDS" type="java.lang.String" value="{'indexName':'visits', 'locations':['http://@es.host@:@es.port@/']}"/>
2. Remove the following instructions from mysql/setup-db.sh or postgres/setup-db.sh:
sed --in-place 's/@es.host@/'"$ELASTICSEARCH_HOST"'/' /usr/local/tomcat/conf/context-$profile.xml sed --in-place 's/@es.port@/'"$ELASTICSEARCH_PORT"'/' /usr/local/tomcat/conf/context-$profile.xml
3. Remove previously added Maven 'docker.es' profile.