Use OpenSearch in your workload ΒΆ

This guide will show you how to connect your workload to a previously created OpenSearch instance.

Prerequisites ΒΆ

Steps ΒΆ

1. Add reference to OpenSearch instance in workload manifest ΒΆ

In your workload manifest, add the following lines to reference the OpenSearch instance:

nais.yaml

Replace $NAME with the name of your OpenSearch instance. If you created your OpenSearch through the legacy method, exclude the opensearch-<TEAM>- prefix.

The access field defines the access level your workload will have to the OpenSearch instance. Choose the access level that fits your use case.

See the available access levels in the OpenSearch reference.

2. Find OpenSearch environment variables ΒΆ

When the workload is deployed, the Nais platform will inject the necessary environment variables to connect to the OpenSearch instance.

See the available environment variables in the OpenSearch reference.

3. Use a OpenSearch client library ΒΆ

Use a OpenSearch client library to connect to the OpenSearch instance using the injected environment variables.

You can find a non-exhaustive list of OpenSearch clients over at the official OpenSearch page: https://docs.opensearch.org/latest/clients/.