Files
doc-exports/docs/css/umn/css_01_0443.html
zhengxiu 2125539080 css umn 25.1.0 version
Reviewed-by: Pruthi, Vineet <vineet.pruthi@t-systems.com>
Co-authored-by: zhengxiu <zhengxiu@huawei.com>
Co-committed-by: zhengxiu <zhengxiu@huawei.com>
2025-07-04 09:10:17 +00:00

84 lines
10 KiB
HTML

<a name="css_01_0443"></a><a name="css_01_0443"></a>
<h1 class="topictitle1">Accessing an OpenSearch Cluster Using cURL Commands</h1>
<div id="body0000001992165565"><p id="css_01_0443__css_01_0384_p128983357017">Open-source Elasticsearch provides a series of RESTful APIs. You can run cURL commands to access these APIs using tools such as Kibana and Postman. This topic describes how to use cURL commands to access an Elasticsearch or OpenSearch cluster.</p>
<div class="section" id="css_01_0443__css_01_0384_en-us_topic_0000001961178833_section346464820183"><h4 class="sectiontitle">Prerequisites</h4><ul id="css_01_0443__css_01_0384_en-us_topic_0000001961178833_ul10447145616424"><li id="css_01_0443__css_01_0384_en-us_topic_0000001961178833_li1044745604219">CSS has an Elasticsearch or OpenSearch cluster that is available.</li><li id="css_01_0443__css_01_0384_en-us_topic_0000001961178833_li1344713562420">An ECS has been created, and it is in the same VPC and security group as the CSS cluster.<ul id="css_01_0443__css_01_0384_ul612451510168"><li id="css_01_0443__css_01_0384_li4839213171619">If they are not in the same security group, modify the ECS security group, or configure the inbound and outbound rules of the group to allow all access from the cluster. For details, see <a href="https://docs.otc.t-systems.com/en-us/usermanual/ecs/en-us_topic_0030878383.html" target="_blank" rel="noopener noreferrer">Configuring Security Group Rules</a>.</li><li id="css_01_0443__css_01_0384_li158392130165">For details about how to use an ECS, see <a href="https://docs.otc.t-systems.com/en-us/usermanual/ecs/en-us_topic_0092494193.html" target="_blank" rel="noopener noreferrer">Creating and Logging In to a Linux ECS</a>.</li></ul>
</li></ul>
</div>
<div class="section" id="css_01_0443__css_01_0384_en-us_topic_0000001961178833_section14909125211516"><h4 class="sectiontitle">Accessing a Cluster</h4><ol id="css_01_0443__css_01_0384_en-us_topic_0000001961178833_ol1651417167525"><li id="css_01_0443__css_01_0384_en-us_topic_0000001961178833_li11618134413130">Obtain the private network address of the cluster. It is used to access the cluster.<p id="css_01_0443__css_01_0384_p152184916443"><a name="css_01_0443__css_01_0384_en-us_topic_0000001961178833_li11618134413130"></a><a name="css_01_0384_en-us_topic_0000001961178833_li11618134413130"></a>This topic uses a private IP address as an example to describe how to access a cluster. The cluster access address varies with the network configurations used. For details, see <a href="css_01_0381.html#css_01_0381__section855085010198">Network Configuration</a>.</p>
<ol type="a" id="css_01_0443__css_01_0384_en-us_topic_0000001961178833_ol1742819417471"><li id="css_01_0443__css_01_0384_en-us_topic_0000001961178833_li07251912434">In the navigation pane on the left, choose <span class="wintitle" id="css_01_0443__css_01_0384_wintitle8395155017380"><b>Clusters</b></span>.</li><li id="css_01_0443__css_01_0384_en-us_topic_0000001961178833_li392216231538">In the cluster list, obtain the IP address of the cluster you want to access from the <strong id="css_01_0443__css_01_0384_b1213816218488">Private Network Address</strong> column. Generally, the IP address format is <em id="css_01_0443__css_01_0384_i913822112488">&lt;host&gt;</em><strong id="css_01_0443__css_01_0384_b11381215483">:</strong><em id="css_01_0443__css_01_0384_i131381621114811">&lt;port&gt;</em> or <em id="css_01_0443__css_01_0384_i9139122154816">&lt;host&gt;</em><strong id="css_01_0443__css_01_0384_b3139821144816">:</strong><em id="css_01_0443__css_01_0384_i71391521194817">&lt;port&gt;</em><strong id="css_01_0443__css_01_0384_b1813942115484">,</strong><em id="css_01_0443__css_01_0384_i1713918215481">&lt;host&gt;</em><strong id="css_01_0443__css_01_0384_b101391921114810">:</strong><em id="css_01_0443__css_01_0384_i111392216488">&lt;port&gt;</em>.<p id="css_01_0443__css_01_0384_en-us_topic_0000001961178833_p18422185125018">If the cluster has only one node, the IP address and port number of this one node are displayed, for example, <strong id="css_01_0443__css_01_0384_b310751519481">10.62.179.32:9200</strong>. If the cluster has multiple nodes, the IP addresses and port numbers of all nodes are displayed, for example, <strong id="css_01_0443__css_01_0384_b1610791594811">10.62.179.32:9200,10.62.179.33:9200</strong>.</p>
</li></ol>
</li><li id="css_01_0443__css_01_0384_en-us_topic_0000001961178833_li13876151991418">Run one of the following commands on the ECS to access the cluster. The access command varies according to the security mode of the cluster.<ul id="css_01_0443__css_01_0384_en-us_topic_0000001961178833_ul48942022152318"><li id="css_01_0443__css_01_0384_en-us_topic_0000001961178833_li789411220236">Cluster in non-security mode<pre class="screen" id="css_01_0443__css_01_0384_en-us_topic_0000001961178833_screen12262625142419">curl "http://&lt;host&gt;:&lt;port&gt;"</pre>
</li><li id="css_01_0443__css_01_0384_en-us_topic_0000001961178833_li10172522142412">Cluster in security mode + HTTP<pre class="screen" id="css_01_0443__css_01_0384_en-us_topic_0000001961178833_screen921113585271">curl -u &lt;user&gt;:&lt;password&gt; "http://&lt;host&gt;:&lt;port&gt;"</pre>
</li><li id="css_01_0443__css_01_0384_en-us_topic_0000001961178833_li1984395519251">Cluster in security mode + HTTPS<pre class="screen" id="css_01_0443__css_01_0384_en-us_topic_0000001961178833_screen7365674284">curl -u &lt;user&gt;:&lt;password&gt; -k "https://&lt;host&gt;:&lt;port&gt;"</pre>
</li></ul>
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="css_01_0443__css_01_0384_en-us_topic_0000001961178833_table111741414338" frame="border" border="1" rules="all"><caption><b>Table 1 </b>Variables</caption><thead align="left"><tr id="css_01_0443__css_01_0384_en-us_topic_0000001961178833_row91731411337"><th align="left" class="cellrowborder" valign="top" width="23.7%" id="mcps1.3.3.2.2.2.2.3.1.1"><p id="css_01_0443__css_01_0384_en-us_topic_0000001961178833_p14171714153311">Variable</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="76.3%" id="mcps1.3.3.2.2.2.2.3.1.2"><p id="css_01_0443__css_01_0384_en-us_topic_0000001961178833_p417131412333">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="css_01_0443__css_01_0384_en-us_topic_0000001961178833_row192601805113"><td class="cellrowborder" valign="top" width="23.7%" headers="mcps1.3.3.2.2.2.2.3.1.1 "><p id="css_01_0443__css_01_0384_en-us_topic_0000001961178833_p19261218155110">&lt;host&gt;</p>
</td>
<td class="cellrowborder" valign="top" width="76.3%" headers="mcps1.3.3.2.2.2.2.3.1.2 "><p id="css_01_0443__css_01_0384_en-us_topic_0000001961178833_p42611819514">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.</p>
</td>
</tr>
<tr id="css_01_0443__css_01_0384_en-us_topic_0000001961178833_row73721818175113"><td class="cellrowborder" valign="top" width="23.7%" headers="mcps1.3.3.2.2.2.2.3.1.1 "><p id="css_01_0443__css_01_0384_en-us_topic_0000001961178833_p133723186514">&lt;port&gt;</p>
</td>
<td class="cellrowborder" valign="top" width="76.3%" headers="mcps1.3.3.2.2.2.2.3.1.2 "><p id="css_01_0443__css_01_0384_en-us_topic_0000001961178833_p16372318165118">Port number for accessing a cluster node. Generally, the port number is 9200.</p>
</td>
</tr>
<tr id="css_01_0443__css_01_0384_en-us_topic_0000001961178833_row131711473319"><td class="cellrowborder" valign="top" width="23.7%" headers="mcps1.3.3.2.2.2.2.3.1.1 "><p id="css_01_0443__css_01_0384_en-us_topic_0000001961178833_p4171147336">&lt;user&gt;</p>
</td>
<td class="cellrowborder" valign="top" width="76.3%" headers="mcps1.3.3.2.2.2.2.3.1.2 "><p id="css_01_0443__css_01_0384_en-us_topic_0000001961178833_p111791417336">Username for accessing the cluster.</p>
</td>
</tr>
<tr id="css_01_0443__css_01_0384_en-us_topic_0000001961178833_row161711420338"><td class="cellrowborder" valign="top" width="23.7%" headers="mcps1.3.3.2.2.2.2.3.1.1 "><p id="css_01_0443__css_01_0384_en-us_topic_0000001961178833_p17171149336">&lt;password&gt;</p>
</td>
<td class="cellrowborder" valign="top" width="76.3%" headers="mcps1.3.3.2.2.2.2.3.1.2 "><p id="css_01_0443__css_01_0384_en-us_topic_0000001961178833_p11713147339">Password of the user.</p>
<p id="css_01_0443__css_01_0384_en-us_topic_0000001961178833_p12911206191917">If the password contains special characters, enclose the username and password in single quotation marks, for example, <span class="parmvalue" id="css_01_0443__css_01_0384_en-us_topic_0000001961178833_parmvalue139114565204"><b>curl -u "user:password!" "http://&lt;host&gt;:&lt;port&gt;"</b></span>.</p>
</td>
</tr>
</tbody>
</table>
</div>
<p id="css_01_0443__css_01_0384_en-us_topic_0000001961178833_p851194212514">An access example is as follows:</p>
<pre class="screen" id="css_01_0443__css_01_0384_en-us_topic_0000001961178833_screen136219151262">curl "http://10.62.176.32:9200"</pre>
<p id="css_01_0443__css_01_0384_en-us_topic_0000001961178833_p10778131918610">Information similar to the following is displayed:</p>
<pre class="screen" id="css_01_0443__css_01_0384_en-us_topic_0000001961178833_screen15227210104616">HTTP/1.1 200 OK
content-type: application/json; charset=UTF-8
content-length: 513
{
"name" : "xxx-1",
"cluster_name" : "xxx",
"cluster_uuid" : "xxx_uuid",
"version" : {
"number" : "7.10.2",
"build_flavor" : "oss",
"build_type" : "tar",
"build_hash" : "unknown",
"build_date" : "unknown",
"build_snapshot" : true,
"lucene_version" : "8.7.0",
"minimum_wire_compatibility_version" : "6.7.0",
"minimum_index_compatibility_version" : "6.0.0-beta1"
},
"tagline" : "You Know, for Search"
}</pre>
<div class="note" id="css_01_0443__css_01_0384_en-us_topic_0000001961178833_note117071415813"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><p id="css_01_0443__css_01_0384_en-us_topic_0000001961178833_p47161416815">For more commands, see the <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/rest-apis.html?spm=a2c4g.11186623.0.0.18211315kMUlbd" target="_blank" rel="noopener noreferrer">Elasticsearch documentation</a>.</p>
</div></div>
</li></ol>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="css_01_0288.html">Accessing an OpenSearch Cluster</a></div>
</div>
</div>