To query or analyze data in OpenSearch, you often need to connect to your cluster from an external client (such as an ECS). This topic describes how to use cURL commands to access an OpenSearch cluster.
This topic uses a private IP address as an example to describe how to access a cluster. The cluster access address varies depending on the network configurations used. For details, see Obtaining the Cluster Access Address.
If the cluster has client nodes, only the IP addresses and ports of all the client nodes are displayed. Otherwise, the IP addresses and ports of all data nodes and cold data nodes are displayed.
curl "http://<host>:<port>"
curl -u <user>:<password> "http://<host>:<port>"
curl -u <user>:<password> -k "https://<host>:<port>"
Variable | Description |
|---|---|
host | IP address of each node in the cluster. If the cluster contains multiple nodes, there will be multiple IP addresses. You can use any of them. |
port | Port number for accessing a cluster node. Generally, the port number is 9200. |
user | Username for accessing the cluster. |
password | Password of the user. If the password contains special characters, enclose the username and password in single quotation marks, for example, curl -u "user:password!" "http://<host>:<port>". |
Example command:
curl "http://10.62.176.32:9200"
Example response:
HTTP/1.1 200 OKcontent-type: application/json; charset=UTF-8content-length: 513{"name" : "css-xxx-ess-esn-3-1","cluster_name" : "css-xxx","cluster_uuid" : "xxx_uuid","version" : {"number" : "7.10.2","build_type" : "tar","build_hash" : "unknown","build_date" : "unknown","build_snapshot" : true,"lucene_version" : "9.12.1","minimum_wire_compatibility_version" : "7.10.0","minimum_index_compatibility_version" : "7.0.0"},"tagline" : "The OpenSearch Project: https://opensearch.org/"}
For more commands, see the OpenSearch documentation.