Skip to main content

Search engine

OpenSearch is the search and indexing engine of the platform. It was chosen over Elasticsearch and Apache Solr for its open-source license and for a security plugin that supports OpenID Connect. See ADR 010.

OpenSearch derives from Elasticsearch 7 and keeps its REST API. That is why inherited code and configuration still use the name elasticsearch (ElasticClientManager, elasticsearchConfig, ELASTICSEARCH_URL): these refer to the OpenSearch cluster.

Who uses it​

ComponentUseIndexes
explorer moduleIndexes the resources and folders of the applications (blog, wiki, mind map, collaborative wall, timeline) and serves their display in the explorerresource-<application>, and resource-explorer for folders
search-engine moduleQueries the explorer indexes, in addition to the MongoDB and PostgreSQL sources of each moduleresource-*
mediacentre moduleResource searchIts own
admin-dashboard moduleFull-text search proxy and indexing over the event busent-*
dashboard applicationModule catalog with faceted search (Searchkit)modules-openent

The explorer receives the creation, change and deletion of resources and indexes them through an ingestion job. Each document carries a rights array (creator:<userId>, user:<userId>:<role>, group:<groupId>:<role>).

Search filters its results on that field: a document is returned only if the member created it, or it is shared with the member or with one of the member's groups, and never if it is in the trash. If the elasticsearchConfig block is absent from a module's configuration, that source is simply disabled.

admin-dashboard module​

The module exposes a REST proxy to OpenSearch:

MethodPathRole
POST/admin-dashboard/management/opensearch/searchFull-text search (multi_match with typo tolerance and highlighting)
GET/admin-dashboard/management/opensearch/indicesLists the indexes that match the configured pattern
GET/admin-dashboard/management/opensearch/healthCluster health

These three routes are reserved for the platform administrator (@AdminFunction("SUPER_ADMIN")), or for a service call carrying a valid X-Api-Key. The proxy queries OpenSearch with a service account and does not apply the rights filter, so it must never be opened to other roles.

The index field of a search is restricted to the pattern set in opensearch.default.index (ent-* by default). An index outside that pattern, such as resource-*, is rejected with a 400 error.

The module also listens on the event bus address fr.tech.openent.opensearch.index. A module can publish a message there to index or delete a document:

{
"action": "upsert",
"index": "ent-wiki",
"id": "60a1b2c3d4e5f6",
"document": {
"title": "My course",
"content": "...",
"owner": { "userId": "user-uuid", "displayName": "First Last" },
"modified": "2026-05-15T10:00:00.000Z"
}
}

action is upsert or delete. No module of the repository publishes on this address yet.

Configuration​

Vert.x modules (ent-core.yaml)​

elasticsearchConfig:
uris:
- ${ELASTICSEARCH_URL}
user: ${ELASTICSEARCH_USERNAME}
password: ${ELASTICSEARCH_PASSWORD}

admin-dashboard module (Quarkus)​

PropertyEnvironment variableDefault
opensearch.urlOPENSEARCH_URLhttp://ent-opensearch:9200
opensearch.usernameOPENSEARCH_USERNAMEadmin
opensearch.passwordOPENSEARCH_PASSWORDnone
opensearch.default.indexOPENSEARCH_DEFAULT_INDEXent-*

dashboard application (Next.js)​

The application reads OPENSEARCH_URL on the server side, and ELASTICSEARCH_USERNAME and ELASTICSEARCH_PASSWORD for the Searchkit search.

Installation​

Local​

Two Docker Compose files exist under starter/:

FileImageSecurityUse
docker-compose.yml (service openent-elasticsearch)opensearchproject/opensearch:2.8.0Security plugin disabled, HTTP on port 9200Day-to-day development
docker-compose-opensearch.ymlopensearchproject/opensearch:2.15.0 and OpenSearch Dashboards 2.15.0TLS and security plugin enabledWorking on the security setup

For the secured setup:

export OPENSEARCH_INITIAL_ADMIN_PASSWORD=<password>
docker-compose -f docker-compose-opensearch.yml up

Certificates are either self-signed (starter/opensearch/self-signed, generated by script-certificate.sh then convert-pem-keystore.sh) or those of your domain (starter/opensearch/acme). With domain certificates, call the cluster by a host name covered by the certificate, not by localhost.

OpenSearch Dashboards listens on port 5601.

Kubernetes​

OpenSearch and OpenSearch Dashboards are dependencies of the Helm charts (opensearch 2.26.1 and opensearch-dashboards 2.24.1), enabled by opensearch.enabled and opensearch-dashboards.enabled.

ChartConfiguration
helm/openent-monolitheSingle node, security plugin disabled, HTTP access inside the cluster through the service opensearch-cluster-master:9200. OpenSearch Dashboards is published under /dashboard-search, protected by basic authentication on the ingress.

Security​

When the security plugin is enabled, OpenSearch is configured with:

  • TLS on the transport and HTTP layers;
  • OpenID Connect authentication against the platform's identity provider, with preferred_username as the identifier and the roles claim of the token for roles;
  • basic authentication against the internal OpenSearch user database as a fallback.

The configuration is in starter/opensearch/opensearch-security/config.yml. Applying it to a running cluster requires an administration certificate:

/usr/share/opensearch/plugins/opensearch-security/tools/securityadmin.sh \
-cd /usr/share/opensearch/config/opensearch-security -icl -nhnv \
-key /usr/share/opensearch/config/node1-key.pem \
-cert /usr/share/opensearch/config/node1.pem \
-cacert /usr/share/opensearch/config/root-ca.pem

Retrieving self-signed certificates​

On a Kubernetes cluster where TLS is enabled, the certificates are in the secret of the master node:

kubectl get secret openent-opensearch-cluster-master-0 -n openent-dev -o jsonpath='{.data.ca\.crt}' | base64 -d > ca.crt
kubectl get secret openent-opensearch-cluster-master-0 -n openent-dev -o jsonpath='{.data.tls\.crt}' | base64 -d > tls.crt
kubectl get secret openent-opensearch-cluster-master-0 -n openent-dev -o jsonpath='{.data.tls\.key}' | base64 -d > tls.key

Calling a self-signed cluster from Bruno​

The Bruno collection open-api/Open ENT v3 Search holds the requests that check the cluster and the module catalog. To call a cluster with a self-signed certificate:

  1. in the Bruno preferences, enable the use of a custom certificate authority and select ca.crt;
  2. if the cluster requires a client certificate, declare tls.crt and tls.key among the client certificates of the collection, for the cluster's domain;
  3. set the hostname_elasticsearch variable of the environment to the https:// address of the cluster.