Add Relevance Experiments and Trends to a Project
Info: This feature in Bloomreach Content requires a standard or premium license. Contact Bloomreach for details.
Overview
This guide explains how to add the Relevance Experiments and Trends features to a Bloomreach Content project. These features are part of the Relevance Module and provide additional tabs—Trends and Goals—in the Content audiences application.
After installation, verify that the Visits Aggregator and Model Trainer are running to ensure correct dataflow configuration.
Installation Using Essentials
You can install Relevance Experiments and Trends through Essentials:
- When starting a new project, select
Make use of Enterprise features. - In Essentials, open the
Librarytab. - Locate the
Relevance Experiments and Trendsfeature and clickInstall feature.
Essentials applies most manual installation steps automatically.
After installation, rebuild and restart your project.
Manual Installation
Before proceeding, ensure you have already completed adding the Relevance Module to your project.
Add the Elasticsearch Maven Plugin to the Cargo Run Profile
To store visits data, configure an Elasticsearch instance in your local Cargo-based development environment using the Elasticsearch Maven Plugin.
- Open your project's top-level
pom.xml. - Find the
cargo.runprofile. - Add these properties to the profile's
<properties>element:
<properties> <!-- existing properties here --> <es.tcpPort>9300</es.tcpPort> <es.path>${project.build.directory}/storage</es.path> <es.skip.start>false</es.skip.start> <es.httpPort>9200</es.httpPort> </properties>
- Immediately after the profile's
<plugins>opening element, add the following plugin configuration:
<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>${targeting.elastic.disabled}</skip> </configuration> </plugin>
This configuration starts a local Elasticsearch instance when you run mvn -P cargo.run. By default, the visits data store uses this local Elasticsearch instance.
Configure a JNDI Environment Variable for Elasticsearch
Set up a JNDI environment variable to provide connection properties for Elasticsearch.
- In your local Cargo-based development environment, open
conf/context.xml. - Add the following environment variable:
<Environment name="elasticsearch/targetingDS" type="java.lang.String" value="{'indexName':'visits', 'locations':['http://localhost:9200/']}" />
The visits data store uses these properties to connect to the Elasticsearch instance.
Enable Elasticsearch Support in HST Configuration
In cms/src/main/webapp/WEB-INF/hst-config.properties, ensure that Elasticsearch support for Relevance is enabled:
targeting.elastic.disabled = false
Hint: The default value is
false. You can remove this line if you do not need to override the default.
Rebuild and Restart the Application
- Stop the application if it is running.
- Rebuild and restart the project as described in the Getting Started Trail.
To verify that Elasticsearch is running, open the following URL in your browser:
http://localhost:9200/_cat/indices?v
You should see output similar to:
health status index pri rep docs.count docs.deleted store.size pri.store.size
green open visits 1 0 0 0 159b 159b
Running in Docker
To enable Relevance Elasticsearch support in a Docker environment, follow these steps.
- Add the following resource/environment configuration to
context-mysql.xmlorcontext-postgres.xml:
<Environment name="elasticsearch/targetingDS" type="java.lang.String"
value="{'indexName':'visits', 'locations':['http://@es.host@:@es.port@/']}"/>
- Add these lines to
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
Add a Docker Elasticsearch Profile
Add the following Maven profile to your configuration:
<profile> <id>docker.es</id> <properties> <docker.es.network.mode>custom</docker.es.network.mode> <docker.es.network.name>${project.artifactId}-network</docker.es.network.name> <docker.es.bind.1>${project.basedir}/target/elasticsearch-data:/usr/share/elasticsearch/data</docker.es.bind.1> <docker.es.wait.time>60000</docker.es.wait.time> <docker.es.wait.log>bound_addresses</docker.es.wait.log> <docker.db.dependsOn.container.1>es</docker.db.dependsOn.container.1> <docker.brxm.envRun.ELASTICSEARCH_HOST>${docker.container.es.net.myproject-network.ip}</docker.brxm.envRun.ELASTICSEARCH_HOST> <docker.brxm.envRun.ELASTICSEARCH_PORT>9200</docker.brxm.envRun.ELASTICSEARCH_PORT> </properties> <build> <plugins> <plugin> <groupId>io.fabric8</groupId> <artifactId>docker-maven-plugin</artifactId> <configuration> <images> <image> <name>docker.elastic.co/elasticsearch/elasticsearch:6.6.0</name> <alias>es</alias> <external> <type>properties</type> <prefix>docker.es</prefix> <mode>override</mode> </external> <run> <log> <enabled>true</enabled> </log> </run> </image> </images> </configuration> </plugin> </plugins> </build> </profile>