How to Connect to OpenSearch Database Clusters

Validated on 17 Jun 2024 • Last edited on 9 Mar 2026

OpenSearch is an open-source search and analytics suite which serves as a centralized location to manage logs forwarded from other resources, such as databases and Droplets.

You can connect to DigitalOcean Managed Databases using command line tools and other third-party clients. This guide explains where to find your OpenSearch database’s connection details and how to use them to configure tools and clients.

Retrieve Database Connection Details Using the CLI

How to Retrieve Database Connection Details Using the DigitalOcean CLI
  1. Install doctl, the official DigitalOcean CLI.
  2. Create a personal access token and save it for use with doctl.
  3. Use the token to grant doctl access to your DigitalOcean account.
    doctl auth init
  4. Finally, run doctl databases connection. Basic usage looks like this, but you can read the usage docs for more details:
    doctl databases connection <database-cluster-id> [flags]
    The following example retrieves the connection details for a database cluster with the ID f81d4fae-7dec-11d0-a765-00a0c91e6bf6:
    doctl databases connection f81d4fae-7dec-11d0-a765-00a0c91e6bf6

Retrieve Database Connection Details Using the API

This API call retrieves the information about your database, including its connection details. The connection details are located in the returned connection JSON object.

How to Retrieve Database Connection Details Using the DigitalOcean API
  1. Create a personal access token and save it for use with the API.
  2. Send a GET request to https://api.digitalocean.com/v2/databases/{database_cluster_uuid}.

cURL

Using cURL:

curl -X GET \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $DIGITALOCEAN_TOKEN" \
  "https://api.digitalocean.com/v2/databases/9cc10173-e9ea-4176-9dbc-a4cee4c4ff30"

Go

Using Godo, the official DigitalOcean API client for Go:

import (
    "context"
    "os"

    "github.com/digitalocean/godo"
)

func main() {
    token := os.Getenv("DIGITALOCEAN_TOKEN")

    client := godo.NewFromToken(token)
    ctx := context.TODO()

    cluster, _, err := client.Databases.Get(ctx, "9cc10173-e9ea-4176-9dbc-a4cee4c4ff30")
}

Python

Using PyDo, the official DigitalOcean API client for Python:

import os
from pydo import Client

client = Client(token=os.environ.get("DIGITALOCEAN_TOKEN"))

get_resp = client.databases.get_cluster(database_cluster_uuid="a7a89a")

View OpenSearch Cluster Connection Details

You use your database’s connection details to configure tools, applications, and resources that connect to the database. To view your database’s connection details, click the name of the cluster on the Databases page to go to its Overview page.

Databases Overview screen showing connection string

You can view customized connection details based on how you want to connect to the database:

  • Public network and Private network (VPC) options generate connection details based on if you want to connect via the cluster’s public hostname or the cluster’s private hostname. Only other resources in the same VPC network as the cluster can access it using its private hostname.

  • The User field updates the connection details with the user credentials that you would like to connect with.

You can also choose to view the connection details in different formats:

  • Connection parameters: Host, port, and authentication information for application configuration.

  • Connection string: A condensed URL that you can pass to a client or use with curl.

OpenSearch exposes a REST API over HTTPS. Use the connection details to build requests to your cluster’s endpoint (for example, https://<your-cluster-hostname>:25060).

By default, the control panel doesn’t reveal the cluster’s password for security reasons. Click Copy to copy connection details with the password, or click show-password to reveal the password.

Download the SSL Certificate

Each managed database comes with an SSL certificate. You can use this SSL certificate to encrypt connections between your client applications and the database.

To download your database’s SSL certificate, click the name of the cluster on the Databases page to go to its Overview page. In the Connection Details section, click Download CA certificate.

Databases connection details with Download CA Certificate selected

When you configure your client applications, you can use the certificate’s location on your local system. Each client application is configured differently, so check the documentation for the tool you’re using for more detail on setting up SSL connections.

Connect to the Database

You can connect to OpenSearch using the command line (for example, curl) or a client that supports the OpenSearch or Elasticsearch API. In this guide, we show you how to connect using curl and how to find connection information for applications.

To connect to OpenSearch database clusters using curl, you need three things:

To send a request to the cluster, use the hostname and port from the control panel with HTTP basic authentication. For example, to check cluster health:

curl -u doadmin:<your-password> \
  --cacert /path/to/ca-certificate.crt \
  https://<your-cluster-hostname>:25060/_cluster/health?pretty

Replace <your-password> with your database user password, <your-cluster-hostname> with the hostname from the control panel, and /path/to/ca-certificate.crt with the path to your database’s SSL certificate.

When the connection succeeds, the cluster returns a JSON response with health and status information.

From here, you can run other OpenSearch API requests. Learn more in the OpenSearch API documentation.

If you’re having trouble connecting to the database, you can troubleshoot the connection using our Support page, or you can reference the OpenSearch documentation.

To connect to OpenSearch database clusters from an application, you need three things:

Configure your client with the cluster endpoint URL (for example, https://<your-cluster-hostname>:25060), the database user and password from the control panel, and the path to your database’s SSL certificate for certificate verification. Exact configuration options depend on the client or library you use.

If you’re having trouble connecting to the database, you can troubleshoot the connection using our Support page, or you can reference the OpenSearch documentation.

We can't find any results for your search.

Try using different keywords or simplifying your search terms.