Use Relevance without Elasticsearch
Overview
You can use the Relevance module in Bloomreach Content without Elasticsearch. This approach removes support for Trends and Experiments features.
When to Use
Use this configuration if you do not require Trends and Experiments and want to avoid the Elasticsearch dependency. This option is available in brXM 14.1.0 and later, as well as in versions 13.4.2 and 14.0.1 through backports.
Prerequisites
- Your project was created using the Maven archetype.
- Relevance was added through Essentials.
- You have a platform properties configuration file. For details, see HST Container Configuration.
- Complete all running experiments and publish channel changes before removing Elasticsearch from a production environment.
Implementation Steps
1. Disable Elasticsearch for Relevance
Add the following property to cms/src/main/webapp/WEB-INF/hst-config.properties:
targeting.elastic.disabled = true
This property disables the Elasticsearch requirement for Relevance. As a result, the Trends and Goals tabs will no longer be available in the Content Audiences application, and you cannot create or start experiments in the Experience manager.
2. Remove Elasticsearch Configuration
a. Remove Environment Variable
Delete the Elasticsearch environment variable from conf/context.xml:
<Environment name="elasticsearch/targetingDS" value="{'indexName':'visits', 'locations':['http://localhost:9200/']}" type="java.lang.String"/>
b. Remove Elasticsearch Maven Plugin (Local Development)
To prevent Elasticsearch from starting during local development, remove the Elasticsearch Maven plugin 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>
c. Exclude Elasticsearch Client Dependencies
Exclude Elasticsearch client dependencies from hippo-addon-targeting-cms-dependencies (or hippo-addon-targeting-platform-dependencies if used).
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>
d. Remove Repository Configuration
Delete the following node from the repository:
/targeting:targeting/targeting:datastores/targeting:visits
3. (Optional) Docker Configuration Cleanup
If you use Docker, perform these additional steps:
- Remove the following element from
context-mysql.xmlandcontext-postgres.xml:
<Environment name="elasticsearch/targetingDS" type="java.lang.String"
value="{'indexName':'visits', 'locations':['http://@es.host@:@es.port@/']}"/>
- Delete these instructions from
mysql/setup-db.shorpostgres/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
- Remove the previously added Maven
docker.esprofile.
Verification
- Confirm that the
TrendsandGoalstabs are no longer present in the Content Audiences application. - Verify that the option to create or start experiments is not available in the Experience manager.
- Ensure that Elasticsearch is not started or required during local development or in production.