This is an internal documentation. There is a good chance you’re looking for something else. See Disclaimer.

Elasticsearch

Configuration

The following properties may be used to configure the connection to the elasticsearch server / elasticsearch index.

nice2.enterprisesearch.elasticsearch.hostName=es1.stage.tocco.cust.vshn.net
nice2.enterprisesearch.elasticsearch.port=443
nice2.enterprisesearch.elasticsearch.indexName=localhost
nice2.enterprisesearch.elasticsearch.username=user-test
nice2.enterprisesearch.elasticsearch.password=xxxxxxx

To be able to connect to our elastic search infrastructure, apply the following patch:

[5:09 PM]Subject: [PATCH] ipv6 elastic
---
Index: customer/build.gradle
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/customer/build.gradle b/customer/build.gradle
--- a/customer/build.gradle  (revision c4d14d20068cd64d18622fd8092595c3aaa012ec)
+++ b/customer/build.gradle  (date 1787906279783)
@@ -215,6 +215,13 @@
    // exceeds 100k lines for some customers). So we restore the pre-JDK-24 behaviour.
    options.addAll(["-Djdk.xml.maxGeneralEntitySizeLimit=0", "-Djdk.xml.totalEntitySizeLimit=50000000"])

+    // Follow the address order of the operating system, like curl and the python elasticsearch check
+    // in `customer/docker-root/usr/local/bin/entrypoint` do. By default the JVM prefers IPv4 and
+    // hosts which are only reachable via IPv6 run into a connect timeout. The apache async http
+    // client used by the elasticsearch client only tries the first resolved address, so there is no
+    // fallback to the second one either.
+    options.add("-Djava.net.preferIPv6Addresses=true")
+
    return options;
}

Local Development

When developing locally the FakeFulltextIndexService is used by default. This service works with using a direct db search instead of using a real elasticsearch instance. If a real elasticsearch backend is required (e.g. to debug / fix issues with the elasticsearch integration), a connection to a elasticsearch backend needs to be configured as described in Configuration.

Used endpoints

Mappings

The mappings endpoint is used when setting up an index.

PUT https://{hostName}/{index-name}/_mapping
{
    "properties": {
        "pagerank": {
            "type": "rank_features",
            "positive_score_impact": true
        },
        "completion_suggestions": {
            "type": "completion"
        }
    }
}

Indexing

If a single entity is saved (inserted or updated) the Index-API endpoint is used to add / update it in the index. If multiple entities need to be added / updated (e.g. when recreating the index) the Bulk-API is used to index multiple entities in a single request.

Deleting

If a single entity is deleted, the Delete-API is used to remove the index entry. If multiple entries need to be removed from the index (e.g. the whole entity model / multiple pks when fixing the index) the Delete-By-Query-API is used.