Accessing an OpenSearch Cluster Using cURL Commands
Open-source OpenSearch provides a series of RESTful APIs. You can run cURL commands to access these APIs using tools such as OpenSearch Dashboards and Postman. This topic describes how to run cURL commands to access an OpenSearch cluster.
Prerequisites
- The target CSS OpenSearch cluster is available.
- An ECS has been created, and it is in the same VPC and security group as the CSS cluster.
- If they are not in the same security group, modify the ECS security group, or configure its inbound and outbound rules to allow all access from the cluster. For details, see Configuring Security Group Rules.
- For details about how to use an ECS, see Purchasing a Custom ECS.
Accessing a Cluster
- Obtain the private network address of the cluster. It is used to access the 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 Network Configuration.
- Log in to the CSS management console.
- In the navigation pane on the left, choose Clusters > OpenSearch.
- In the cluster list, obtain the target cluster's private IP address from the Private IP Address column. Generally, the IP address format is <host>:<port> or <host>:<port>,<host>:<port>.
If the cluster has only one node, the IP address and port number of this one node are displayed, for example, 10.62.179.32:9200. If the cluster has multiple nodes, the IP addresses and port numbers of all nodes are displayed, for example, 10.62.179.32:9200,10.62.179.33:9200.
- Run one of the following commands on the ECS to access the cluster. The access command varies depending on the security mode of the cluster.
- For a cluster with the security mode disabled:
curl "http://<host>:<port>"
- For a security-mode cluster that uses HTTP:
curl -u <user>:<password> "http://<host>:<port>"
- For a security-mode cluster that uses HTTPS:
curl -u <user>:<password> -k "https://<host>:<port>"
Table 1 Variables 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 OK content-type: application/json; charset=UTF-8 content-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 a cluster with the security mode disabled:
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot