Skip to content

OpenSearch ​

Part of the Sidecar Services catalog.

What it does ​

OpenSearch is the open-source fork of Elasticsearch. As a sidecar it backs faceted search and full-text queries on a project locally, standing in for a hosted OpenSearch cluster the production site queries. Add it when a project targets OpenSearch (for example sites on AWS OpenSearch Service) and you want the search backend running on your machine.

How it works ​

The preset pins opensearchproject/opensearch:2.13.0 and listens on container port 9200. It runs as a single node with the security plugin disabled (discovery.type=single-node, DISABLE_SECURITY_PLUGIN=true, DISABLE_INSTALL_DEMO_CONFIG=true) and a fixed 512m heap, so there is no TLS or demo-user setup to work around locally. The index persists in a named volume mounted at /usr/share/opensearch/data.

OpenSearch gets a browser UI: the host port is auto-allocated from the 7000 to 7999 range and de-conflicted across all projects.

bash
wdg my-site service add opensearch
wdg my-site service list

Read the browser URL from the service list output.

How it integrates with the local WordPress container ​

Adding the sidecar injects these env vars into the WordPress container:

VariableValue
OPENSEARCH_HOSTwdg-my-site-opensearch (the @HOST token resolved at add-time)
OPENSEARCH_PORT9200

WordPress reaches OpenSearch over wdg-network at wdg-my-site-opensearch:9200, never the host port. The host port exists only for your browser.

These env vars are connectivity hints. The project supplies the code that consumes them. A client reads the values in PHP and connects without credentials, since the security plugin is disabled for local use:

php
$host = getenv( 'OPENSEARCH_HOST' ); // wdg-my-site-opensearch
$port = getenv( 'OPENSEARCH_PORT' ); // 9200
$endpoint = "http://{$host}:{$port}";

Adding the sidecar wires reachability only. The project installs and configures the search integration.

Add and remove ​

bash
wdg my-site service add opensearch
wdg my-site service remove opensearch          # keeps the data volume
wdg my-site service remove opensearch --purge  # also deletes the data volume