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:

  1. When starting a new project, select Make use of Enterprise features.
  2. In Essentials, open the Library tab.
  3. Locate the Relevance Experiments and Trends feature and click Install 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.

  1. Open your project's top-level pom.xml.
  2. Find the cargo.run profile.
  3. 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>
  1. 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.

  1. In your local Cargo-based development environment, open conf/context.xml.
  2. 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

  1. Stop the application if it is running.
  2. 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.

  1. Add the following resource/environment configuration to context-mysql.xml or context-postgres.xml:
<Environment name="elasticsearch/targetingDS" type="java.lang.String"
 value="{'indexName':'visits', 'locations':['http://@es.host@:@es.port@/']}"/>
  1. Add these lines to 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

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>
Share Feedback
Page: /build/enterprise-plugins/targeting-relevance/add-relevance-experiments-and-trends-to-project
Section: Build
Category *