Files
doc-exports/docs/css/umn/css_01_0047.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

151 lines
18 KiB
HTML

<a name="EN-US_TOPIC_0000002386670109"></a><a name="EN-US_TOPIC_0000002386670109"></a>
<h1 class="topictitle1">Configuring an Index Recycle Bin for an OpenSearch Cluster</h1>
<div id="body0000002386670109"><p id="EN-US_TOPIC_0000002386670109__p1772002412405">By default, when indexes are deleted in an OpenSearch cluster, the index data is deleted permanently. To prevent data loss caused by accidental deletion, CSS provides an index recycle bin. When enabled, deleted indexes are temporarily stored in the recycle bin, allowing for recovery before they are permanently removed. This feature improves data reliability and operational security.</p>
<div class="section" id="EN-US_TOPIC_0000002386670109__section1590125419405"><h4 class="sectiontitle">How the Feature Works</h4><p id="EN-US_TOPIC_0000002386670109__p78111317104114">The index recycle bin works as follows:</p>
<ul id="EN-US_TOPIC_0000002386670109__ul43711332134116"><li id="EN-US_TOPIC_0000002386670109__li1537183224117">Data recycling mechanism: When an index is deleted, it is first moved to the recycle bin. From there, it will be automatically cleared when a predefined retention duration expires. Indexes in the recycle bin are still part of the cluster metadata and can be restored using an API.</li><li id="EN-US_TOPIC_0000002386670109__li5371123213412">Status management<ul id="EN-US_TOPIC_0000002386670109__ul1689485314114"><li id="EN-US_TOPIC_0000002386670109__li93711032104112">When the DELETE API is used to delete an index, the index is closed, and the cluster status temporarily changes to Red.</li><li id="EN-US_TOPIC_0000002386670109__li1437116325415">When the restore API is used to restore an index, the index is reopened and shards are initialized, which may also cause the cluster status to temporarily change to Red.</li></ul>
</li></ul>
</div>
<div class="section" id="EN-US_TOPIC_0000002386670109__section9897287266"><h4 class="sectiontitle">Constraints</h4><ul id="EN-US_TOPIC_0000002386670109__ul96081153594"><li id="EN-US_TOPIC_0000002386670109__li5608135319911">Only OpenSearch 2.19.0 supports the index recycle bin.</li></ul>
<ul id="EN-US_TOPIC_0000002386670109__ul13857135016269"><li id="EN-US_TOPIC_0000002386670109__li1857450122615">Indexes in the recycle bin are still part of the cluster metadata. Before they are removed from the recycle bin, same-name indexes cannot be created for the cluster.</li></ul>
</div>
<div class="section" id="EN-US_TOPIC_0000002386670109__section253155420232"><h4 class="sectiontitle">Logging In to OpenSearch Dashboards</h4><p id="EN-US_TOPIC_0000002386670109__en-us_topic_0000002338102386_p13118645151118">Log in to OpenSearch Dashboards and go to the command execution page. OpenSearch clusters support multiple access methods. This topic uses OpenSearch Dashboards as an example to describe the operation procedures.</p>
<ol id="EN-US_TOPIC_0000002386670109__en-us_topic_0000002338102386_ol511804517115"><li id="EN-US_TOPIC_0000002386670109__en-us_topic_0000002338102386_li111185453113"><span id="EN-US_TOPIC_0000002386670109__en-us_topic_0000002338102386_ph134648105316">Log in to the CSS management console.</span></li><li id="EN-US_TOPIC_0000002386670109__en-us_topic_0000002338102386_li1711804571114">In the navigation pane on the left, choose <span class="uicontrol" id="EN-US_TOPIC_0000002386670109__en-us_topic_0000002338102386_uicontrol1511834581115"><b>Clusters &gt; OpenSearch</b></span>.</li><li id="EN-US_TOPIC_0000002386670109__en-us_topic_0000002338102386_li201181045151113">In the cluster list, find the target cluster, and click <strong id="EN-US_TOPIC_0000002386670109__en-us_topic_0000002338102386_b8963520674129">Dashboards</strong> in the <strong id="EN-US_TOPIC_0000002386670109__en-us_topic_0000002338102386_b1363282744129">Operation</strong> column to log in to OpenSearch Dashboards.</li><li id="EN-US_TOPIC_0000002386670109__en-us_topic_0000002338102386_li811824512111">In the left navigation pane, choose <strong id="EN-US_TOPIC_0000002386670109__en-us_topic_0000002338102386_b45261424710">Dev Tools</strong>.<p id="EN-US_TOPIC_0000002386670109__en-us_topic_0000002338102386_p539424154519">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.</p>
</li></ol>
</div>
<div class="section" id="EN-US_TOPIC_0000002386670109__section174503513432"><h4 class="sectiontitle">Enabling the Index Recycle Bin</h4><p id="EN-US_TOPIC_0000002386670109__p151341657192511">Run the following command to enable the index recycle bin:</p>
<pre class="screen" id="EN-US_TOPIC_0000002386670109__screen6814124417234">PUT _cluster/settings
{
"persistent": {
"index.trash.enabled": true
}
}</pre>
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0000002386670109__table65681030176" frame="border" border="1" rules="all"><caption><b>Table 1 </b>Parameters for enabling the index recycle bin</caption><thead align="left"><tr id="EN-US_TOPIC_0000002386670109__row1556818313175"><th align="left" class="cellrowborder" valign="top" width="30%" id="mcps1.3.5.4.2.4.1.1"><p id="EN-US_TOPIC_0000002386670109__p45686391712">Parameter</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="20%" id="mcps1.3.5.4.2.4.1.2"><p id="EN-US_TOPIC_0000002386670109__p16809130109">Type</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="50%" id="mcps1.3.5.4.2.4.1.3"><p id="EN-US_TOPIC_0000002386670109__p156811351711">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="EN-US_TOPIC_0000002386670109__row1456833141714"><td class="cellrowborder" valign="top" width="30%" headers="mcps1.3.5.4.2.4.1.1 "><p id="EN-US_TOPIC_0000002386670109__p956812321718">index.trash.enabled</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.5.4.2.4.1.2 "><p id="EN-US_TOPIC_0000002386670109__p19810140309">Boolean</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.5.4.2.4.1.3 "><p id="EN-US_TOPIC_0000002386670109__p136510256716">Whether to enable the index recycle bin. When the index recycle bin is enabled, deleting indexes will first move them to the recycle bin. The indexes will be permanently deleted only when they are cleared from the recycle bin.</p>
<ul id="EN-US_TOPIC_0000002386670109__ul136372816290"><li id="EN-US_TOPIC_0000002386670109__li1763162882917"><strong id="EN-US_TOPIC_0000002386670109__b6155733151217">true</strong>: Enable the index recycle bin.</li><li id="EN-US_TOPIC_0000002386670109__li76352814290"><strong id="EN-US_TOPIC_0000002386670109__b136901737161211">false</strong> (default): Disable the index recycle bin.</li></ul>
</td>
</tr>
<tr id="EN-US_TOPIC_0000002386670109__row145687331717"><td class="cellrowborder" valign="top" width="30%" headers="mcps1.3.5.4.2.4.1.1 "><p id="EN-US_TOPIC_0000002386670109__p95686319177">indices.trash.keep.time</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.5.4.2.4.1.2 "><p id="EN-US_TOPIC_0000002386670109__p198101108011">String</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.5.4.2.4.1.3 "><p id="EN-US_TOPIC_0000002386670109__p1219193819816">Index retention duration in the recycle bin. Indexes will be automatically removed from the recycle bin when this duration expires.</p>
<p id="EN-US_TOPIC_0000002386670109__p34451653988">Examples of supported time formats: <span class="parmvalue" id="EN-US_TOPIC_0000002386670109__parmvalue710814439919"><b>1d</b></span> (one day), <span class="parmvalue" id="EN-US_TOPIC_0000002386670109__parmvalue12439134614911"><b>7d</b></span> (seven days), <span class="parmvalue" id="EN-US_TOPIC_0000002386670109__parmvalue1358617551895"><b>1w</b></span> (one week), <span class="parmvalue" id="EN-US_TOPIC_0000002386670109__parmvalue1348212591192"><b>1h</b></span> (one hour). The minimum duration is <span class="parmvalue" id="EN-US_TOPIC_0000002386670109__parmvalue61591513191016"><b>1d</b></span>.</p>
<p id="EN-US_TOPIC_0000002386670109__p5416123114819">Default value: <span class="parmvalue" id="EN-US_TOPIC_0000002386670109__parmvalue67702031798"><b>1d</b></span>.</p>
</td>
</tr>
</tbody>
</table>
</div>
<div class="note" id="EN-US_TOPIC_0000002386670109__note68481929804"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><div class="p" id="EN-US_TOPIC_0000002386670109__p1984014020520">The following command deletes an index:<pre class="screen" id="EN-US_TOPIC_0000002386670109__screen79041327115720">DELETE <em id="EN-US_TOPIC_0000002386670109__i057313455583">{INDEX_NAME}</em></pre>
</div>
<p id="EN-US_TOPIC_0000002386670109__p17605123961419"><strong id="EN-US_TOPIC_0000002386670109__b1319634313910">INDEX_NAME</strong> indicates the name of the index to be deleted. Wildcards can be used to specify indexes.</p>
</div></div>
</div>
<div class="section" id="EN-US_TOPIC_0000002386670109__section61032015567"><h4 class="sectiontitle">Viewing Indexes in the Recycle Bin</h4><p id="EN-US_TOPIC_0000002386670109__p784152117249">Run the following command to view indexes in the index recycle bin:</p>
<pre class="screen" id="EN-US_TOPIC_0000002386670109__screen109418338271">GET _cat/trash?<em id="EN-US_TOPIC_0000002386670109__i154461247673">v=true&amp;s=index</em></pre>
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0000002386670109__table843716448299" frame="border" border="1" rules="all"><caption><b>Table 2 </b>Parameter description</caption><thead align="left"><tr id="EN-US_TOPIC_0000002386670109__row743744412911"><th align="left" class="cellrowborder" valign="top" width="18.77%" id="mcps1.3.6.4.2.3.1.1"><p id="EN-US_TOPIC_0000002386670109__p7437124413296">Parameter</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="81.23%" id="mcps1.3.6.4.2.3.1.2"><p id="EN-US_TOPIC_0000002386670109__p6437644132915">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="EN-US_TOPIC_0000002386670109__row1143713444296"><td class="cellrowborder" valign="top" width="18.77%" headers="mcps1.3.6.4.2.3.1.1 "><p id="EN-US_TOPIC_0000002386670109__p1943716447292">v</p>
</td>
<td class="cellrowborder" valign="top" width="81.23%" headers="mcps1.3.6.4.2.3.1.2 "><p id="EN-US_TOPIC_0000002386670109__p15437194410299">Whether to display the table header when the return format is a table.</p>
<ul id="EN-US_TOPIC_0000002386670109__ul76349221383"><li id="EN-US_TOPIC_0000002386670109__li4635152215813">true: display the table header.</li><li id="EN-US_TOPIC_0000002386670109__li96351322188">false: not display the table header.</li></ul>
<p id="EN-US_TOPIC_0000002386670109__p21648290813">The default value is <strong id="EN-US_TOPIC_0000002386670109__b1352157392">false</strong>.</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000002386670109__row1343774402915"><td class="cellrowborder" valign="top" width="18.77%" headers="mcps1.3.6.4.2.3.1.1 "><p id="EN-US_TOPIC_0000002386670109__p1043734410297">s</p>
</td>
<td class="cellrowborder" valign="top" width="81.23%" headers="mcps1.3.6.4.2.3.1.2 "><p id="EN-US_TOPIC_0000002386670109__p14437744182914">Index sorting fields. Options include <span class="parmname" id="EN-US_TOPIC_0000002386670109__parmname1752724473813"><b>index</b></span>, <span class="parmname" id="EN-US_TOPIC_0000002386670109__parmname1452715443380"><b>uuid</b></span>, <span class="parmname" id="EN-US_TOPIC_0000002386670109__parmname1252864493818"><b>pri</b></span>, <span class="parmname" id="EN-US_TOPIC_0000002386670109__parmname25281044173818"><b>rep</b></span>, <span class="parmname" id="EN-US_TOPIC_0000002386670109__parmname165281144183814"><b>trash.ts</b></span>, and <span class="parmname" id="EN-US_TOPIC_0000002386670109__parmname1352894423815"><b>delete.time</b></span>.</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000002386670109__row144371344112913"><td class="cellrowborder" valign="top" width="18.77%" headers="mcps1.3.6.4.2.3.1.1 "><p id="EN-US_TOPIC_0000002386670109__p1543734482918">format</p>
</td>
<td class="cellrowborder" valign="top" width="81.23%" headers="mcps1.3.6.4.2.3.1.2 "><p id="EN-US_TOPIC_0000002386670109__p3438544102918">Return format of the command. The default format is table. Other options include json, yaml, cobr, and smile. cobr and smile are binary formats.</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000002386670109__row643824410293"><td class="cellrowborder" valign="top" width="18.77%" headers="mcps1.3.6.4.2.3.1.1 "><p id="EN-US_TOPIC_0000002386670109__p7438114422916">h</p>
</td>
<td class="cellrowborder" valign="top" width="81.23%" headers="mcps1.3.6.4.2.3.1.2 "><p id="EN-US_TOPIC_0000002386670109__p172071235111117">Set the column names to be displayed. By default, all column names are displayed. To specify multiple column names, separate them using commas (,), for example, <strong id="EN-US_TOPIC_0000002386670109__b1811854615356">h=index,uuid,delete.time</strong>.</p>
</td>
</tr>
</tbody>
</table>
</div>
<p id="EN-US_TOPIC_0000002386670109__p4730102482716">The following is an example of the output.</p>
<pre class="screen" id="EN-US_TOPIC_0000002386670109__screen9561132172814">index uuid pri rep trash.ts delete.time
index1 CMD3FCLzTOyTg4RUekWNNA 1 1 1714465116615 23.6h
index1 6ATijuu6SfqamVI-WMyOKg 1 1 1714466233898 23.9h</pre>
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0000002386670109__table1616611511307" frame="border" border="1" rules="all"><caption><b>Table 3 </b>Parameters in the output</caption><thead align="left"><tr id="EN-US_TOPIC_0000002386670109__row1819485113308"><th align="left" class="cellrowborder" valign="top" width="12.55%" id="mcps1.3.6.7.2.3.1.1"><p id="EN-US_TOPIC_0000002386670109__p14194145113016">Column</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="87.45%" id="mcps1.3.6.7.2.3.1.2"><p id="EN-US_TOPIC_0000002386670109__p21941517305">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="EN-US_TOPIC_0000002386670109__row111941351163013"><td class="cellrowborder" valign="top" width="12.55%" headers="mcps1.3.6.7.2.3.1.1 "><p id="EN-US_TOPIC_0000002386670109__p919418511307">index</p>
</td>
<td class="cellrowborder" valign="top" width="87.45%" headers="mcps1.3.6.7.2.3.1.2 "><p id="EN-US_TOPIC_0000002386670109__p719419513304">Index name</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000002386670109__row1919425103015"><td class="cellrowborder" valign="top" width="12.55%" headers="mcps1.3.6.7.2.3.1.1 "><p id="EN-US_TOPIC_0000002386670109__p619465113015">uuid</p>
</td>
<td class="cellrowborder" valign="top" width="87.45%" headers="mcps1.3.6.7.2.3.1.2 "><p id="EN-US_TOPIC_0000002386670109__p21945516301">Index UUID</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000002386670109__row1194105116306"><td class="cellrowborder" valign="top" width="12.55%" headers="mcps1.3.6.7.2.3.1.1 "><p id="EN-US_TOPIC_0000002386670109__p119475123015">pri</p>
</td>
<td class="cellrowborder" valign="top" width="87.45%" headers="mcps1.3.6.7.2.3.1.2 "><p id="EN-US_TOPIC_0000002386670109__p10194451183015">Number of shards of an index</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000002386670109__row51943513304"><td class="cellrowborder" valign="top" width="12.55%" headers="mcps1.3.6.7.2.3.1.1 "><p id="EN-US_TOPIC_0000002386670109__p10194125143018">rep</p>
</td>
<td class="cellrowborder" valign="top" width="87.45%" headers="mcps1.3.6.7.2.3.1.2 "><p id="EN-US_TOPIC_0000002386670109__p41944511301">Number of replicas of an index</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000002386670109__row3194751103017"><td class="cellrowborder" valign="top" width="12.55%" headers="mcps1.3.6.7.2.3.1.1 "><p id="EN-US_TOPIC_0000002386670109__p14194125133016">trash.ts</p>
</td>
<td class="cellrowborder" valign="top" width="87.45%" headers="mcps1.3.6.7.2.3.1.2 "><p id="EN-US_TOPIC_0000002386670109__p6195351193017">Time when an index was moved to the recycle bin</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000002386670109__row1819514519303"><td class="cellrowborder" valign="top" width="12.55%" headers="mcps1.3.6.7.2.3.1.1 "><p id="EN-US_TOPIC_0000002386670109__p20195195133018">delete.time</p>
</td>
<td class="cellrowborder" valign="top" width="87.45%" headers="mcps1.3.6.7.2.3.1.2 "><p id="EN-US_TOPIC_0000002386670109__p5195951193017">Remaining retention duration of an index in the recycle bin. When the value changes to 0, the index is permanently deleted.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="section" id="EN-US_TOPIC_0000002386670109__section142171239125919"><h4 class="sectiontitle">Restoring an Index from the Recycle Bin</h4><p id="EN-US_TOPIC_0000002386670109__p82761334152713">Run the following command to restore an index from the recycle bin:</p>
<pre class="screen" id="EN-US_TOPIC_0000002386670109__screen1436213293212">POST /trash/recover/<em id="EN-US_TOPIC_0000002386670109__i128588493133">{INDEX_NAME}</em></pre>
<p id="EN-US_TOPIC_0000002386670109__p17194819203219"><strong id="EN-US_TOPIC_0000002386670109__b133611972360">INDEX_NAME</strong> indicates the name of the index to be restored. Wildcards can be used to specify indexes.</p>
</div>
<div class="section" id="EN-US_TOPIC_0000002386670109__section2255174216155"><h4 class="sectiontitle">Emptying the Recycle Bin</h4><p id="EN-US_TOPIC_0000002386670109__p1254465081512">Run the following command to empty the recycle bin:</p>
<pre class="screen" id="EN-US_TOPIC_0000002386670109__screen67851312111615">POST trash/empty</pre>
<p id="EN-US_TOPIC_0000002386670109__p14666193311617">Emptying the recycle bin will permanently delete all data in it. Please exercise caution.</p>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="css_01_0095.html">Enhancing Search Capabilities for OpenSearch Clusters</a></div>
</div>
</div>