Files
doc-exports/docs/css/umn/index.html
zhengxiu 93d856d5c5 css umn 25.6.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-11-25 11:34:43 +00:00

443 lines
39 KiB
HTML

<a name="EN-US_TOPIC_0000001995777894"></a><a name="EN-US_TOPIC_0000001995777894"></a>
<h1 class="topictitle1">Using Elasticsearch for Data Search</h1>
<div id="body8662426"><p id="EN-US_TOPIC_0000001995777894__p6920131444611">This section provides an example of how an e-commerce website uses a CSS Elasticsearch cluster to implement a product search function, including creating indexes, importing data, and searching for data.</p>
<div class="section" id="EN-US_TOPIC_0000001995777894__en-us_topic_0000001223434400_section15177859183319"><h4 class="sectiontitle">Scenario Description</h4><p id="EN-US_TOPIC_0000001995777894__en-us_topic_0000001223434400_p98074268319">A women's clothing brand runs an e-commerce website. It has been using traditional databases to power a product search function on this website. However, as the website traffic increases, these traditional databases are struggling to keep up, leading to slow responses and low search accuracy. To improve shopping experience for customers, the e-commerce website plans to use Cloud Search Service (CSS) to provide the product search function.</p>
<div class="p" id="EN-US_TOPIC_0000001995777894__en-us_topic_0000001223434400_p16542124819143">Assume that the e-commerce website has the data shown in <a href="#EN-US_TOPIC_0000001995777894__table157036273511">Table 1</a>:
<div class="tablenoborder"><a name="EN-US_TOPIC_0000001995777894__table157036273511"></a><a name="table157036273511"></a><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0000001995777894__table157036273511" frame="border" border="1" rules="all"><caption><b>Table 1 </b>Products sold by one e-commerce website</caption><thead align="left"><tr id="EN-US_TOPIC_0000001995777894__row9703162103513"><th align="left" class="cellrowborder" valign="top" width="50%" id="mcps1.3.2.3.2.2.3.1.1"><p id="EN-US_TOPIC_0000001995777894__p87038213517">productName</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="50%" id="mcps1.3.2.3.2.2.3.1.2"><p id="EN-US_TOPIC_0000001995777894__p37031326352">size</p>
</th>
</tr>
</thead>
<tbody><tr id="EN-US_TOPIC_0000001995777894__row2070342143510"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.2.3.2.2.3.1.1 "><p id="EN-US_TOPIC_0000001995777894__p470492183515">Latest art shirts for women in autumn 2017</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.2.3.2.2.3.1.2 "><p id="EN-US_TOPIC_0000001995777894__p1070410210351">L</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001995777894__row37042223512"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.2.3.2.2.3.1.1 "><p id="EN-US_TOPIC_0000001995777894__p570411215355">Latest art shirts for women in autumn 2017</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.2.3.2.2.3.1.2 "><p id="EN-US_TOPIC_0000001995777894__p177045273516">M</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001995777894__row1770414215356"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.2.3.2.2.3.1.1 "><p id="EN-US_TOPIC_0000001995777894__p20704172183513">Latest art shirts for women in autumn 2017</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.2.3.2.2.3.1.2 "><p id="EN-US_TOPIC_0000001995777894__p17043216357">S</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001995777894__row8704929352"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.2.3.2.2.3.1.1 "><p id="EN-US_TOPIC_0000001995777894__p97045217359">Latest jeans for women in spring 2018</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.2.3.2.2.3.1.2 "><p id="EN-US_TOPIC_0000001995777894__p177042233517">M</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001995777894__row47041420358"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.2.3.2.2.3.1.1 "><p id="EN-US_TOPIC_0000001995777894__p127049293520">Latest jeans for women in spring 2018</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.2.3.2.2.3.1.2 "><p id="EN-US_TOPIC_0000001995777894__p1704327352">S</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001995777894__row137043263514"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.2.3.2.2.3.1.1 "><p id="EN-US_TOPIC_0000001995777894__p17704721351">Latest casual pants for women in spring 2017</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.2.3.2.2.3.1.2 "><p id="EN-US_TOPIC_0000001995777894__p270419214351">L</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001995777894__row37042216359"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.2.3.2.2.3.1.1 "><p id="EN-US_TOPIC_0000001995777894__p117047214352">Latest casual pants for women in spring 2017</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.2.3.2.2.3.1.2 "><p id="EN-US_TOPIC_0000001995777894__p15704152183511">S</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div class="section" id="EN-US_TOPIC_0000001995777894__section18297385416"><h4 class="sectiontitle">Procedure</h4><p id="EN-US_TOPIC_0000001995777894__p57741198516">The following describes how to use an Elasticsearch cluster to implement a website search function.</p>
<ol id="EN-US_TOPIC_0000001995777894__ol62501051174313"><li id="EN-US_TOPIC_0000001995777894__li1680813511820"><a href="#EN-US_TOPIC_0000001995777894__en-us_topic_0000001223434400_section96881833619">Step 1: Creating a Cluster</a>: Create a non-security mode Elasticsearch cluster for data search.</li><li id="EN-US_TOPIC_0000001995777894__li129511983615"><a href="#EN-US_TOPIC_0000001995777894__section5871145214010">Step 2: Logging In to Kibana</a>: Log in to the cluster through Kibana.</li><li id="EN-US_TOPIC_0000001995777894__li0691182719364"><a href="#EN-US_TOPIC_0000001995777894__section1651413823111">Step 3: Creating an Index</a>: Create indexes in the cluster through Kibana.</li><li id="EN-US_TOPIC_0000001995777894__li9637145514311"><a href="#EN-US_TOPIC_0000001995777894__en-us_topic_0000001223434400_section398512163445">Step 4: Importing Data</a>: Use an open-source Elasticsearch API to import data on Kibana.</li><li id="EN-US_TOPIC_0000001995777894__li18821185824319"><a href="#EN-US_TOPIC_0000001995777894__en-us_topic_0000001223434400_section167624221443">Step 5: Searching for Data</a>: Perform full-text search and result aggregation and display on data in the Elasticsearch cluster.</li><li id="EN-US_TOPIC_0000001995777894__li19888216449"><a href="#EN-US_TOPIC_0000001995777894__section342432816441">Step 6: Deleting Indexes</a>: Delete indexes that you no longer need to reclaim resources.</li></ol>
</div>
<div class="section" id="EN-US_TOPIC_0000001995777894__en-us_topic_0000001223434400_section96881833619"><a name="EN-US_TOPIC_0000001995777894__en-us_topic_0000001223434400_section96881833619"></a><a name="en-us_topic_0000001223434400_section96881833619"></a><h4 class="sectiontitle">Step 1: Creating a Cluster</h4><p id="EN-US_TOPIC_0000001995777894__p135149124018">Create a non-security mode Elasticsearch cluster for data search.</p>
<ol id="EN-US_TOPIC_0000001995777894__ol1856284171012"><li id="EN-US_TOPIC_0000001995777894__en-us_topic_0000001268594549_li5509181942419"><span id="EN-US_TOPIC_0000001995777894__ph9699352125015">Log in to the CSS management console.</span></li><li id="EN-US_TOPIC_0000001995777894__li2128143411410">In the navigation pane on the left, choose <span class="menucascade" id="EN-US_TOPIC_0000001995777894__menucascade82984220292338"><b><span class="uicontrol" id="EN-US_TOPIC_0000001995777894__uicontrol96181583992338">Clusters</span></b> &gt; <b><span class="uicontrol" id="EN-US_TOPIC_0000001995777894__uicontrol150088720892338">Elasticsearch</span></b></span>.</li><li id="EN-US_TOPIC_0000001995777894__en-us_topic_0000001268594549_li18509111942412">Click <span class="uicontrol" id="EN-US_TOPIC_0000001995777894__uicontrol6626172102116"><b><span id="EN-US_TOPIC_0000001995777894__text2626226215">Create Cluster</span></b></span> in the upper-right corner. The <strong id="EN-US_TOPIC_0000001995777894__b862642202115">Create Cluster</strong> page is displayed.</li><li id="EN-US_TOPIC_0000001995777894__en-us_topic_0000001268594549_li1550911962418">Configure Billing Mode and AZ for the cluster.
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0000001995777894__en-us_topic_0000001268594549_table123919163912" frame="border" border="1" rules="all"><caption><b>Table 2 </b>Billing mode and AZ parameters</caption><thead align="left"><tr id="EN-US_TOPIC_0000001995777894__en-us_topic_0000001268594549_row6240191618912"><th align="left" class="cellrowborder" valign="top" width="25%" id="mcps1.3.4.3.4.1.2.4.1.1"><p id="EN-US_TOPIC_0000001995777894__en-us_topic_0000001268594549_p6240101619913">Parameter</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="50%" id="mcps1.3.4.3.4.1.2.4.1.2"><p id="EN-US_TOPIC_0000001995777894__en-us_topic_0000001268594549_p1324019161897">Description</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="25%" id="mcps1.3.4.3.4.1.2.4.1.3"><p id="EN-US_TOPIC_0000001995777894__p948515196358">Example Value</p>
</th>
</tr>
</thead>
<tbody><tr id="EN-US_TOPIC_0000001995777894__en-us_topic_0000001268594549_row1324031620914"><td class="cellrowborder" valign="top" width="25%" headers="mcps1.3.4.3.4.1.2.4.1.1 "><p id="EN-US_TOPIC_0000001995777894__en-us_topic_0000001268594549_p82406161916">Region</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.4.3.4.1.2.4.1.2 "><p id="EN-US_TOPIC_0000001995777894__p14453728143913">Select the region where the cluster is located.</p>
<p id="EN-US_TOPIC_0000001995777894__p174542028183916">ECSs in different regions cannot communicate with each other over an intranet. For lower network latency and quicker resource access, select the nearest region.</p>
</td>
<td class="cellrowborder" valign="top" width="25%" headers="mcps1.3.4.3.4.1.2.4.1.3 "><p id="EN-US_TOPIC_0000001995777894__p185630185317">xxx</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001995777894__en-us_topic_0000001268594549_row112401161695"><td class="cellrowborder" valign="top" width="25%" headers="mcps1.3.4.3.4.1.2.4.1.1 "><p id="EN-US_TOPIC_0000001995777894__en-us_topic_0000001268594549_p142401416791">AZ</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.4.3.4.1.2.4.1.2 "><p id="EN-US_TOPIC_0000001995777894__p2179143916580">Select AZs associated with the cluster region. A maximum of three AZs can be configured.</p>
</td>
<td class="cellrowborder" valign="top" width="25%" headers="mcps1.3.4.3.4.1.2.4.1.3 "><p id="EN-US_TOPIC_0000001995777894__p8485219113515">AZ 1</p>
</td>
</tr>
</tbody>
</table>
</div>
</li><li id="EN-US_TOPIC_0000001995777894__li123193515165">Configure basic cluster information.<div class="fignone" id="EN-US_TOPIC_0000001995777894__fig18104131510404"><span class="figcap"><b>Figure 1 </b>Configuring cluster information</span><br><span><img id="EN-US_TOPIC_0000001995777894__image1137122115262" src="figure/en-us_image_0000001995777910.png"></span></div>
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0000001995777894__table1321016145541" frame="border" border="1" rules="all"><caption><b>Table 3 </b>Basic configuration parameters</caption><thead align="left"><tr id="EN-US_TOPIC_0000001995777894__row3211614155413"><th align="left" class="cellrowborder" valign="top" width="25%" id="mcps1.3.4.3.5.2.2.4.1.1"><p id="EN-US_TOPIC_0000001995777894__p132111614145417">Parameter</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="50%" id="mcps1.3.4.3.5.2.2.4.1.2"><p id="EN-US_TOPIC_0000001995777894__p1421181485416">Description</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="25%" id="mcps1.3.4.3.5.2.2.4.1.3"><p id="EN-US_TOPIC_0000001995777894__p8375182654413">Example Value</p>
</th>
</tr>
</thead>
<tbody><tr id="EN-US_TOPIC_0000001995777894__row12423414104316"><td class="cellrowborder" valign="top" width="25%" headers="mcps1.3.4.3.5.2.2.4.1.1 "><p id="EN-US_TOPIC_0000001995777894__p142415149434">Cluster Type</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.4.3.5.2.2.4.1.2 "><p id="EN-US_TOPIC_0000001995777894__p2424141414317">Select <strong id="EN-US_TOPIC_0000001995777894__b5171105585119">Elasticsearch</strong>.</p>
</td>
<td class="cellrowborder" valign="top" width="25%" headers="mcps1.3.4.3.5.2.2.4.1.3 "><p id="EN-US_TOPIC_0000001995777894__p537552610449">Elasticsearch</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001995777894__row1211201415414"><td class="cellrowborder" valign="top" width="25%" headers="mcps1.3.4.3.5.2.2.4.1.1 "><p id="EN-US_TOPIC_0000001995777894__p5211141435411">Cluster Version</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.4.3.5.2.2.4.1.2 "><p id="EN-US_TOPIC_0000001995777894__p7211101485417">Select a cluster version from the drop-down list.</p>
</td>
<td class="cellrowborder" valign="top" width="25%" headers="mcps1.3.4.3.5.2.2.4.1.3 "><p id="EN-US_TOPIC_0000001995777894__p10375726134417">7.10.2</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001995777894__row12211101419548"><td class="cellrowborder" valign="top" width="25%" headers="mcps1.3.4.3.5.2.2.4.1.1 "><p id="EN-US_TOPIC_0000001995777894__p192115147543">Cluster Name</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.4.3.5.2.2.4.1.2 "><p id="EN-US_TOPIC_0000001995777894__p1321131485417">User-defined cluster name.</p>
</td>
<td class="cellrowborder" valign="top" width="25%" headers="mcps1.3.4.3.5.2.2.4.1.3 "><p id="EN-US_TOPIC_0000001995777894__p4375192617445">Sample-ESCluster</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001995777894__row64554586147"><td class="cellrowborder" valign="top" width="25%" headers="mcps1.3.4.3.5.2.2.4.1.1 "><p id="EN-US_TOPIC_0000001995777894__p15455458141419">Cluster Description</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.4.3.5.2.2.4.1.2 "><p id="EN-US_TOPIC_0000001995777894__p745514581148">Add a description for the cluster for easy recognition.</p>
</td>
<td class="cellrowborder" valign="top" width="25%" headers="mcps1.3.4.3.5.2.2.4.1.3 "><p id="EN-US_TOPIC_0000001995777894__p1845615813142">/</p>
</td>
</tr>
</tbody>
</table>
</div>
</li><li id="EN-US_TOPIC_0000001995777894__en-us_topic_0000001268594549_li952461910242">Configure the cluster's node specifications.
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0000001995777894__table1229280542" frame="border" border="1" rules="all"><caption><b>Table 4 </b>Specification parameters</caption><thead align="left"><tr id="EN-US_TOPIC_0000001995777894__row13224286541"><th align="left" class="cellrowborder" valign="top" width="25%" id="mcps1.3.4.3.6.1.2.4.1.1"><p id="EN-US_TOPIC_0000001995777894__p1422172875415">Parameter</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="50%" id="mcps1.3.4.3.6.1.2.4.1.2"><p id="EN-US_TOPIC_0000001995777894__p22214283545">Description</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="25%" id="mcps1.3.4.3.6.1.2.4.1.3"><p id="EN-US_TOPIC_0000001995777894__p118141644585">Example Value</p>
</th>
</tr>
</thead>
<tbody><tr id="EN-US_TOPIC_0000001995777894__row102322825413"><td class="cellrowborder" valign="top" width="25%" headers="mcps1.3.4.3.6.1.2.4.1.1 "><p id="EN-US_TOPIC_0000001995777894__p82352875414">Nodes</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.4.3.6.1.2.4.1.2 "><p id="EN-US_TOPIC_0000001995777894__p4235287547">Set the number of nodes in the cluster. Select a number from 1 to 32.</p>
</td>
<td class="cellrowborder" valign="top" width="25%" headers="mcps1.3.4.3.6.1.2.4.1.3 "><p id="EN-US_TOPIC_0000001995777894__p10814204185818">1</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001995777894__row1823162815545"><td class="cellrowborder" valign="top" width="25%" headers="mcps1.3.4.3.6.1.2.4.1.1 "><p id="EN-US_TOPIC_0000001995777894__p16231928185420">CPU Architecture</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.4.3.6.1.2.4.1.2 "><p id="EN-US_TOPIC_0000001995777894__p423828105412">The CPU architectures actually supported vary depending on the regional environment.</p>
</td>
<td class="cellrowborder" valign="top" width="25%" headers="mcps1.3.4.3.6.1.2.4.1.3 "><p id="EN-US_TOPIC_0000001995777894__p9814184195816">x86</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001995777894__row1123172810542"><td class="cellrowborder" valign="top" width="25%" headers="mcps1.3.4.3.6.1.2.4.1.1 "><p id="EN-US_TOPIC_0000001995777894__p122314281542">Node Specifications</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.4.3.6.1.2.4.1.2 "><p id="EN-US_TOPIC_0000001995777894__p12231283542">Select the specifications of cluster nodes.</p>
</td>
<td class="cellrowborder" valign="top" width="25%" headers="mcps1.3.4.3.6.1.2.4.1.3 "><p id="EN-US_TOPIC_0000001995777894__p78324321702">css.medium.8</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001995777894__row72312286545"><td class="cellrowborder" valign="top" width="25%" headers="mcps1.3.4.3.6.1.2.4.1.1 "><p id="EN-US_TOPIC_0000001995777894__p1923112895417">Node Storage Type</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.4.3.6.1.2.4.1.2 "><p id="EN-US_TOPIC_0000001995777894__p1924928125418">Select the storage type of cluster nodes.</p>
</td>
<td class="cellrowborder" valign="top" width="25%" headers="mcps1.3.4.3.6.1.2.4.1.3 "><p id="EN-US_TOPIC_0000001995777894__p78159455812">High I/O</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001995777894__row142442895418"><td class="cellrowborder" valign="top" width="25%" headers="mcps1.3.4.3.6.1.2.4.1.1 "><p id="EN-US_TOPIC_0000001995777894__p824328125419">Node Storage Capacity</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.4.3.6.1.2.4.1.2 "><p id="EN-US_TOPIC_0000001995777894__p924182825410">Node storage capacity. Its value range varies with node specifications. The node storage capacity must be a multiple of 20.</p>
</td>
<td class="cellrowborder" valign="top" width="25%" headers="mcps1.3.4.3.6.1.2.4.1.3 "><p id="EN-US_TOPIC_0000001995777894__p1681514135813">40GB</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001995777894__row1124182812540"><td class="cellrowborder" valign="top" width="25%" headers="mcps1.3.4.3.6.1.2.4.1.1 "><p id="EN-US_TOPIC_0000001995777894__p42416285547">Master node</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.4.3.6.1.2.4.1.2 "><p id="EN-US_TOPIC_0000001995777894__p15249282549">The Master node manages all node tasks in the cluster.</p>
</td>
<td class="cellrowborder" valign="top" width="25%" headers="mcps1.3.4.3.6.1.2.4.1.3 "><p id="EN-US_TOPIC_0000001995777894__p20815184105813">Unselect it.</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001995777894__row16241928195416"><td class="cellrowborder" valign="top" width="25%" headers="mcps1.3.4.3.6.1.2.4.1.1 "><p id="EN-US_TOPIC_0000001995777894__p5241528135410">Client node</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.4.3.6.1.2.4.1.2 "><p id="EN-US_TOPIC_0000001995777894__p16241028165418">Client nodes receive and coordinate external requests, such as search and write requests.</p>
</td>
<td class="cellrowborder" valign="top" width="25%" headers="mcps1.3.4.3.6.1.2.4.1.3 "><p id="EN-US_TOPIC_0000001995777894__p281510419589">Unselect it.</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001995777894__row22452825417"><td class="cellrowborder" valign="top" width="25%" headers="mcps1.3.4.3.6.1.2.4.1.1 "><p id="EN-US_TOPIC_0000001995777894__p122412288547">Cold data node</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.4.3.6.1.2.4.1.2 "><p id="EN-US_TOPIC_0000001995777894__p954513294250">Cold data nodes are used to store data that is not particularly sensitive to query latency in large quantities.</p>
</td>
<td class="cellrowborder" valign="top" width="25%" headers="mcps1.3.4.3.6.1.2.4.1.3 "><p id="EN-US_TOPIC_0000001995777894__p1781511410588">Unselect it.</p>
</td>
</tr>
</tbody>
</table>
</div>
</li><li id="EN-US_TOPIC_0000001995777894__en-us_topic_0000001268594549_li1135515195712">Set the enterprise project.<p id="EN-US_TOPIC_0000001995777894__en-us_topic_0000001268594549_p135517191870"><a name="EN-US_TOPIC_0000001995777894__en-us_topic_0000001268594549_li1135515195712"></a><a name="en-us_topic_0000001268594549_li1135515195712"></a>When creating a CSS cluster, you can bind an enterprise project to the cluster if you have enabled the enterprise project function. In this example, <strong id="EN-US_TOPIC_0000001995777894__b105491147500">default</strong>, the default enterprise project, is selected.</p>
</li><li id="EN-US_TOPIC_0000001995777894__li0385174916451">Click <strong id="EN-US_TOPIC_0000001995777894__b12409172883712">Next: Network</strong> to configure the cluster network.<div class="fignone" id="EN-US_TOPIC_0000001995777894__fig15783183135314"><span class="figcap"><b>Figure 2 </b>Configuring networking</span><br><span><img id="EN-US_TOPIC_0000001995777894__image89581293308" src="figure/en-us_image_0000002032217241.png"></span></div>
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0000001995777894__table148003595419" frame="border" border="1" rules="all"><caption><b>Table 5 </b>Network configuration parameters</caption><thead align="left"><tr id="EN-US_TOPIC_0000001995777894__row248033515418"><th align="left" class="cellrowborder" valign="top" width="25%" id="mcps1.3.4.3.8.3.2.4.1.1"><p id="EN-US_TOPIC_0000001995777894__p248083525419">Parameter</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="50%" id="mcps1.3.4.3.8.3.2.4.1.2"><p id="EN-US_TOPIC_0000001995777894__p948013351541">Description</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="25%" id="mcps1.3.4.3.8.3.2.4.1.3"><p id="EN-US_TOPIC_0000001995777894__p11436105917126">Example Value</p>
</th>
</tr>
</thead>
<tbody><tr id="EN-US_TOPIC_0000001995777894__row19481435135412"><td class="cellrowborder" valign="top" width="25%" headers="mcps1.3.4.3.8.3.2.4.1.1 "><p id="EN-US_TOPIC_0000001995777894__p64811535135419">VPC</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.4.3.8.3.2.4.1.2 "><p id="EN-US_TOPIC_0000001995777894__p18481203595410">Specify a VPC to isolate the cluster's network.</p>
<div class="note" id="EN-US_TOPIC_0000001995777894__note11481183518542"><span class="notetitle"> NOTE: </span><div class="notebody"><p id="EN-US_TOPIC_0000001995777894__p20481133514546">The VPC must contain CIDRs. Otherwise, cluster creation will fail. By default, a VPC will contain CIDRs.</p>
</div></div>
</td>
<td class="cellrowborder" valign="top" width="25%" headers="mcps1.3.4.3.8.3.2.4.1.3 "><p id="EN-US_TOPIC_0000001995777894__p9748641121317">vpc-default</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001995777894__row4481133514543"><td class="cellrowborder" valign="top" width="25%" headers="mcps1.3.4.3.8.3.2.4.1.1 "><p id="EN-US_TOPIC_0000001995777894__p19481163505411">Subnet</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.4.3.8.3.2.4.1.2 "><p id="EN-US_TOPIC_0000001995777894__p1548173575415">A subnet provides dedicated network resources that are isolated from other networks, improving network security.</p>
</td>
<td class="cellrowborder" valign="top" width="25%" headers="mcps1.3.4.3.8.3.2.4.1.3 "><p id="EN-US_TOPIC_0000001995777894__p174818418138">subnet-default</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001995777894__row18481153525410"><td class="cellrowborder" valign="top" width="25%" headers="mcps1.3.4.3.8.3.2.4.1.1 "><p id="EN-US_TOPIC_0000001995777894__p11481123515413">Security Group</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.4.3.8.3.2.4.1.2 "><p id="EN-US_TOPIC_0000001995777894__p15873620156">A security group serves as a virtual firewall that provides access control policies for clusters.</p>
<div class="note" id="EN-US_TOPIC_0000001995777894__note4654131710161"><span class="notetitle"> NOTE: </span><div class="notebody"><p id="EN-US_TOPIC_0000001995777894__p1548163585419">To enable cluster access, ensure that port 9200 is allowed by the security group.</p>
</div></div>
</td>
<td class="cellrowborder" valign="top" width="25%" headers="mcps1.3.4.3.8.3.2.4.1.3 "><p id="EN-US_TOPIC_0000001995777894__p3786143115199">default</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001995777894__row1048163519548"><td class="cellrowborder" valign="top" width="25%" headers="mcps1.3.4.3.8.3.2.4.1.1 "><p id="EN-US_TOPIC_0000001995777894__p2482113565410">Security Mode</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.4.3.8.3.2.4.1.2 "><p id="EN-US_TOPIC_0000001995777894__p348273512546">After the security mode is enabled, communication will be encrypted and authentication required for the cluster.</p>
</td>
<td class="cellrowborder" valign="top" width="25%" headers="mcps1.3.4.3.8.3.2.4.1.3 "><p id="EN-US_TOPIC_0000001995777894__p13436135914128">Disable</p>
</td>
</tr>
</tbody>
</table>
</div>
</li><li id="EN-US_TOPIC_0000001995777894__li46248216474">Click <strong id="EN-US_TOPIC_0000001995777894__b1624685123416">Next: Advanced Settings</strong>. Configure automatic snapshot creation and other functions.<p id="EN-US_TOPIC_0000001995777894__p5705121635516">This cluster is used only for getting started. Cluster snapshots and advanced functions are not required.</p>
</li><li id="EN-US_TOPIC_0000001995777894__li19390191716563">Click <strong id="EN-US_TOPIC_0000001995777894__b194065324382">Next: Confirm</strong>. Check the configuration and click <strong id="EN-US_TOPIC_0000001995777894__b13406932193818">Next</strong> to create a cluster.</li><li id="EN-US_TOPIC_0000001995777894__li974913587566">Click <span class="uicontrol" id="EN-US_TOPIC_0000001995777894__uicontrol725983610387"><b>Back to Cluster List</b></span> to switch to the <strong id="EN-US_TOPIC_0000001995777894__b92591236193812">Clusters</strong> page. The cluster you created is now in the cluster list and its status is <strong id="EN-US_TOPIC_0000001995777894__b172611331382">Creating</strong>. If the cluster is successfully created, its status changes to <strong id="EN-US_TOPIC_0000001995777894__b126253173817">Available</strong>.<div class="fignone" id="EN-US_TOPIC_0000001995777894__fig12129152015719"><span class="figcap"><b>Figure 3 </b>Creating a cluster</span><br><span><img id="EN-US_TOPIC_0000001995777894__image612914208578" src="figure/en-us_image_0000001995618190.png"></span></div>
</li></ol>
</div>
<div class="section" id="EN-US_TOPIC_0000001995777894__section5871145214010"><a name="EN-US_TOPIC_0000001995777894__section5871145214010"></a><a name="section5871145214010"></a><h4 class="sectiontitle">Step 2: Logging In to Kibana</h4><p id="EN-US_TOPIC_0000001995777894__p18019391717">After an Elasticsearch cluster is created, you can access the cluster through Kibana.</p>
<ol id="EN-US_TOPIC_0000001995777894__ol13043917110"><li id="EN-US_TOPIC_0000001995777894__li406393117">From the Elasticsearch cluster list, select the created <strong id="EN-US_TOPIC_0000001995777894__b012719436513">Sample-ESCluster</strong> cluster and click <strong id="EN-US_TOPIC_0000001995777894__b712744312514">Access Kibana</strong> in the <strong id="EN-US_TOPIC_0000001995777894__b1312713434511">Operation</strong> column to access the Kibana console.</li><li id="EN-US_TOPIC_0000001995777894__li8012398114">In the left navigation pane on the Kibana console, click <strong id="EN-US_TOPIC_0000001995777894__b13222153822419">Dev Tools</strong>.<div class="p" id="EN-US_TOPIC_0000001995777894__p1203394115">The left part of the console is the command input box, and the triangle icon in its upper-right corner is the execution button. The right part shows the execution result.<div class="fignone" id="EN-US_TOPIC_0000001995777894__fig10139413"><span class="figcap"><b>Figure 4 </b>Kibana console</span><br><span><img id="EN-US_TOPIC_0000001995777894__image17093915117" src="figure/en-us_image_0000002295063054.png"></span></div>
</div>
</li></ol>
</div>
<div class="section" id="EN-US_TOPIC_0000001995777894__section1651413823111"><a name="EN-US_TOPIC_0000001995777894__section1651413823111"></a><a name="section1651413823111"></a><h4 class="sectiontitle">Step 3: Creating an Index</h4><p id="EN-US_TOPIC_0000001995777894__p2391123113217">Create an index in the Elasticsearch cluster to store data.</p>
<div class="p" id="EN-US_TOPIC_0000001995777894__p3551186327">Run the following command on Kibana to create an index named <span class="parmname" id="EN-US_TOPIC_0000001995777894__parmname691502711615"><b>my_store</b></span>:<pre class="screen" id="EN-US_TOPIC_0000001995777894__screen34309112567">PUT /my_store
{
"settings": {
"number_of_shards": 1
},
"mappings": {
"properties": {
"productName": {
"type": "text",
"analyzer": "ik_smart"
},
"size": {
"type": "keyword"
}
}
}
}</pre>
</div>
<p id="EN-US_TOPIC_0000001995777894__p1343016195616">The command output is similar to the following:</p>
<pre class="screen" id="EN-US_TOPIC_0000001995777894__screen4430131155616">{
"acknowledged" : true,
"shards_acknowledged" : true,
"index" : "my_store"
}</pre>
</div>
<div class="section" id="EN-US_TOPIC_0000001995777894__en-us_topic_0000001223434400_section398512163445"><a name="EN-US_TOPIC_0000001995777894__en-us_topic_0000001223434400_section398512163445"></a><a name="en-us_topic_0000001223434400_section398512163445"></a><h4 class="sectiontitle">Step 4: Importing Data</h4><p id="EN-US_TOPIC_0000001995777894__p13503384269">There are several ways to import data to an Elasticsearch cluster. In this example, we use an open-source Elasticsearch API to import data on Kibana.</p>
<div class="p" id="EN-US_TOPIC_0000001995777894__p264184814327">On the Kibana console, run the following command to import data to the index named <span class="parmname" id="EN-US_TOPIC_0000001995777894__parmname18514181582810"><b>my_store</b></span>:<pre class="screen" id="EN-US_TOPIC_0000001995777894__screen24251510165711">POST /my_store/_bulk
{"index":{}}
{"productName":"Latest art shirts for women in autumn 2017","size":"L"}
{"index":{}}
{"productName":"Latest art shirts for women in autumn 2017","size":"M"}
{"index":{}}
{"productName":"Latest art shirts for women in autumn 2017","size":"S"}
{"index":{}}
{"productName":"Latest jeans for women in spring 2018","size":"M"}
{"index":{}}
{"productName":"Latest jeans for women in spring 2018","size":"S"}
{"index":{}}
{"productName":"Latest casual pants for women in spring 2017","size":"L"}
{"index":{}}
{"productName":"Latest casual pants for women in spring 2017","size":"S"}</pre>
</div>
<p id="EN-US_TOPIC_0000001995777894__p2042551019578">If the value of the <span class="parmname" id="EN-US_TOPIC_0000001995777894__parmname236302852317"><b>errors</b></span> field in the command output is <span class="parmvalue" id="EN-US_TOPIC_0000001995777894__parmvalue436372815234"><b>false</b></span>, the data is imported successfully.</p>
</div>
<div class="section" id="EN-US_TOPIC_0000001995777894__en-us_topic_0000001223434400_section167624221443"><a name="EN-US_TOPIC_0000001995777894__en-us_topic_0000001223434400_section167624221443"></a><a name="en-us_topic_0000001223434400_section167624221443"></a><h4 class="sectiontitle">Step 5: Searching for Data</h4><p id="EN-US_TOPIC_0000001995777894__p947614719430">Perform full-text search and result aggregation and display on data in the Elasticsearch cluster.</p>
<ul id="EN-US_TOPIC_0000001995777894__en-us_topic_0000001223434400_ul1826814131366"><li id="EN-US_TOPIC_0000001995777894__en-us_topic_0000001223434400_li826816134618"><strong id="EN-US_TOPIC_0000001995777894__b109135622318">Full-text search</strong><p id="EN-US_TOPIC_0000001995777894__en-us_topic_0000001223434400_p1123422620167">If you access the e-commerce website and want to search for items whose names include "spring jeans", enter "spring jeans" to begin your search.</p>
<p id="EN-US_TOPIC_0000001995777894__en-us_topic_0000001223434400_p13713546141016">Run the following command on Kibana:</p>
<pre class="screen" id="EN-US_TOPIC_0000001995777894__en-us_topic_0000001223434400_screen511015127416">GET /my_store/_search
{
"query": {"match": {
"productName": "spring jeans"
}}
}</pre>
<p id="EN-US_TOPIC_0000001995777894__en-us_topic_0000001223434400_p264111561320">The command output is similar to the following:</p>
<pre class="screen" id="EN-US_TOPIC_0000001995777894__en-us_topic_0000001223434400_screen442411164812">{
"took" : 3,
"timed_out" : false,
"_shards" : {
"total" : 1,
"successful" : 1,
"skipped" : 0,
"failed" : 0
},
"hits" : {
"total" : {
"value" : 4,
"relation" : "eq"
},
"max_score" : 1.7965372,
"hits" : [
{
"_index" : "my_store",
"_type" : "_doc",
"_id" : "9xf6VHIBfClt6SDjw7H5",
"_score" : 1.7965372,
"_source" : {
"productName": "Latest jeans for women in spring 2018",
"size" : "M"
}
},
{
"_index" : "my_store",
"_type" : "_doc",
"_id" : "-Bf6VHIBfClt6SDjw7H5",
"_score" : 1.7965372,
"_source" : {
"productName": "Latest jeans for women in spring 2018",
"size" : "S"
}
},
{
"_index" : "my_store",
"_type" : "_doc",
"_id" : "-Rf6VHIBfClt6SDjw7H5",
"_score" : 0.5945667,
"_source" : {
"productName": "Latest casual pants for women in spring 2017",
"size" : "L"
}
},
{
"_index" : "my_store",
"_type" : "_doc",
"_id" : "-hf6VHIBfClt6SDjw7H5",
"_score" : 0.5945667,
"_source" : {
"productName": "Latest casual pants for women in spring 2017",
"size" : "S"
}
}
]
}
}
</pre>
<ul id="EN-US_TOPIC_0000001995777894__en-us_topic_0000001223434400_ul1515122217247"><li id="EN-US_TOPIC_0000001995777894__en-us_topic_0000001223434400_li10342845132318">Elasticsearch supports IK word segmentation. The search command above segments "spring jeans" into "spring" and "jeans".</li><li id="EN-US_TOPIC_0000001995777894__en-us_topic_0000001223434400_li61511122152415">Elasticsearch supports full-text search. The command above searches for all items whose names include "spring" or "jeans".</li><li id="EN-US_TOPIC_0000001995777894__en-us_topic_0000001223434400_li14281247258">Unlike traditional databases, Elasticsearch can return results in milliseconds by using inverted indexes.</li><li id="EN-US_TOPIC_0000001995777894__en-us_topic_0000001223434400_li1345681018563">Elasticsearch supports ranking by score. In the command output, the first two items contains both "spring" and "jeans", while the last two items contain only "spring". Therefore, the first two items rank higher than the last two as they are more relevant to the search word.</li></ul>
</li></ul>
<ul id="EN-US_TOPIC_0000001995777894__en-us_topic_0000001223434400_ul4149154594416"><li id="EN-US_TOPIC_0000001995777894__en-us_topic_0000001223434400_li1093164683813"><strong id="EN-US_TOPIC_0000001995777894__b16480125420306">Aggregated result display</strong><p id="EN-US_TOPIC_0000001995777894__en-us_topic_0000001223434400_p19910171720276">The e-commerce website displays aggregated results. For example, it classifies items corresponding to "spring" based on sizes so that you can count the number of items of different sizes.</p>
<p id="EN-US_TOPIC_0000001995777894__en-us_topic_0000001223434400_p207753616243">Run the following result aggregation command on Kibana:</p>
<pre class="screen" id="EN-US_TOPIC_0000001995777894__en-us_topic_0000001223434400_screen773343785617">GET /my_store/_search
{
"query": {
"match": {
"productName": "Spring",
}
},
"size": 0,
"aggs": {
"sizes": {
"terms": {
"field": "size"
}
}
}
}</pre>
<p id="EN-US_TOPIC_0000001995777894__en-us_topic_0000001223434400_p2102146133116">The command output is similar to the following:</p>
<pre class="screen" id="EN-US_TOPIC_0000001995777894__en-us_topic_0000001223434400_screen7685125915116">{
"took" : 3,
"timed_out" : false,
"_shards" : {
"total" : 1,
"successful" : 1,
"skipped" : 0,
"failed" : 0
},
"hits" : {
"total" : {
"value" : 4,
"relation" : "eq"
},
"max_score" : null,
"hits" : [ ]
},
"aggregations" : {
"sizes" : {
"doc_count_error_upper_bound" : 0,
"sum_other_doc_count" : 0,
"buckets" : [
{
"key" : "S",
"doc_count" : 2
},
{
"key" : "L",
"doc_count" : 1
},
{
"key" : "M",
"doc_count" : 1
}
]
}
}
}</pre>
</li></ul>
</div>
<div class="section" id="EN-US_TOPIC_0000001995777894__section342432816441"><a name="EN-US_TOPIC_0000001995777894__section342432816441"></a><a name="section342432816441"></a><h4 class="sectiontitle">Step 6: Deleting Indexes</h4><p id="EN-US_TOPIC_0000001995777894__p13513617455">If an index is no longer used, run the following command on Kibana to delete it to reclaim resources:</p>
<pre class="screen" id="EN-US_TOPIC_0000001995777894__screen113995264615">DELETE /my_store</pre>
<p id="EN-US_TOPIC_0000001995777894__p122881705469">The command output is similar to the following:</p>
<pre class="screen" id="EN-US_TOPIC_0000001995777894__screen5498171154712">{
"acknowledged" : true
}</pre>
</div>
<div class="section" id="EN-US_TOPIC_0000001995777894__en-us_topic_0000001223434400_section75027114374"><h4 class="sectiontitle">Follow-up Operations</h4><p id="EN-US_TOPIC_0000001995777894__p104001167492">You can delete the cluster if you no longer need it.</p>
<div class="warning" id="EN-US_TOPIC_0000001995777894__note14771311144415"><span class="warningtitle"><img src="public_sys-resources/warning_3.0-en-us.png"> </span><div class="warningbody"><p id="EN-US_TOPIC_0000001995777894__en-us_topic_0000001223434400_p13627600357">After you delete a cluster, its data cannot be restored. Exercise caution when deleting a cluster.</p>
</div></div>
<ol id="EN-US_TOPIC_0000001995777894__en-us_topic_0000001223434400_ol197114498387"><li id="EN-US_TOPIC_0000001995777894__li1461011017472"><span id="EN-US_TOPIC_0000001995777894__ph5841164119535">Log in to the CSS management console.</span></li><li id="EN-US_TOPIC_0000001995777894__en-us_topic_0000001223434400_li271949183818">In the navigation pane on the left, choose <span class="menucascade" id="EN-US_TOPIC_0000001995777894__menucascade50494079692338"><b><span class="uicontrol" id="EN-US_TOPIC_0000001995777894__uicontrol205468100992338">Clusters</span></b> &gt; <b><span class="uicontrol" id="EN-US_TOPIC_0000001995777894__uicontrol59963061292338">Elasticsearch</span></b></span>.</li><li id="EN-US_TOPIC_0000001995777894__en-us_topic_0000001223434400_li671154953820">In the cluster list, locate the <span class="parmname" id="EN-US_TOPIC_0000001995777894__en-us_topic_0000001223434400_parmname1242641182614"><b>Sample-ESCluster</b></span> cluster, and choose <strong id="EN-US_TOPIC_0000001995777894__b813014403147">More</strong> &gt; <strong id="EN-US_TOPIC_0000001995777894__b151301140141417">Delete</strong> in the <strong id="EN-US_TOPIC_0000001995777894__b4130124013148">Operation</strong> column.</li><li id="EN-US_TOPIC_0000001995777894__en-us_topic_0000001223434400_li13711149113813">In the confirmation dialog box, type in <span class="parmvalue" id="EN-US_TOPIC_0000001995777894__parmvalue459316411299"><b>DELETE</b></span>, and click <span class="uicontrol" id="EN-US_TOPIC_0000001995777894__uicontrol3593143293"><b>OK</b></span>.</li></ol>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="css_00_0002.html">Getting Started</a></div>
</div>
</div>