doc-exports/docs/css/umn/css_01_0121.html
Wuwan, Qi 050b395397 CSS UMN 23.2.1 20230926
Reviewed-by: Kacur, Michal <michal.kacur@t-systems.com>
Co-authored-by: Wuwan, Qi <wuwanqi1@noreply.gitea.eco.tsi-dev.otc-service.com>
Co-committed-by: Wuwan, Qi <wuwanqi1@noreply.gitea.eco.tsi-dev.otc-service.com>
2024-01-10 14:23:15 +00:00

231 lines
29 KiB
HTML

<a name="css_01_0121"></a><a name="css_01_0121"></a>
<h1 class="topictitle1">Creating a Vector Index</h1>
<div id="body0000001309709789"><div class="section" id="css_01_0121__en-us_topic_0000001309709789_section116717617479"><h4 class="sectiontitle">Prerequisites</h4><ul id="css_01_0121__en-us_topic_0000001309709789_ul955544019474"><li id="css_01_0121__en-us_topic_0000001309709789_li17555184014718">A cluster of version 7.6.2 or 7.10.2 has been created by referring to <a href="css_01_0122.html">Cluster Planning for Vector Retrieval</a>.</li><li id="css_01_0121__en-us_topic_0000001309709789_li17555184014711">Cluster advanced settings have been configured as required by referring to <a href="#css_01_0121__en-us_topic_0000001309709789_section8992201842518">Advanced Cluster Configurations</a>.</li></ul>
</div>
<div class="section" id="css_01_0121__en-us_topic_0000001309709789_section137344225249"><a name="css_01_0121__en-us_topic_0000001309709789_section137344225249"></a><a name="en-us_topic_0000001309709789_section137344225249"></a><h4 class="sectiontitle">Creating a Vector Index</h4><ol id="css_01_0121__en-us_topic_0000001309709789_ol927111214106"><li id="css_01_0121__en-us_topic_0000001309709789_li3555152983620">Log in to the CSS management console.</li><li id="css_01_0121__en-us_topic_0000001309709789_li1274935516811">Choose <strong id="css_01_0121__en-us_topic_0000001309709789_b536618488328">Clusters</strong> in the navigation pane. On the <span class="uicontrol" id="css_01_0121__en-us_topic_0000001309709789_uicontrol642931451013"><b>Clusters</b></span> page, locate the target cluster and click <span class="uicontrol" id="css_01_0121__en-us_topic_0000001309709789_uicontrol474915551482"><b>Access Kibana</b></span> in the <strong id="css_01_0121__en-us_topic_0000001309709789_b17528072222">Operation</strong> column.</li><li id="css_01_0121__en-us_topic_0000001309709789_li927171291011">Click <strong id="css_01_0121__en-us_topic_0000001309709789_b1867110133234">Dev Tools</strong> in the navigation tree on the left and run the following command to create a vector index.<p id="css_01_0121__en-us_topic_0000001309709789_p201369284315">Create an index named <strong id="css_01_0121__en-us_topic_0000001309709789_b871914852415">my_index</strong> that contains a vector field <strong id="css_01_0121__en-us_topic_0000001309709789_b124901353246">my_vector</strong> and a text field <strong id="css_01_0121__en-us_topic_0000001309709789_b139915367258">my_label</strong>. The vector field creates the graph index and uses Euclidean distance to measure similarity.</p>
<pre class="screen" id="css_01_0121__en-us_topic_0000001309709789_screen1122662184413">PUT <strong id="css_01_0121__en-us_topic_0000001309709789_b36573428595">my_index</strong>
{
"settings": {
"index": {
"vector": true
}
},
"mappings": {
"properties": {
"<strong id="css_01_0121__en-us_topic_0000001309709789_b5599194810597">my_vector</strong>": {
"type": "vector",
"dimension": 2,
"indexing": true,
"algorithm": "GRAPH",
"metric": "euclidean"
},
"<strong id="css_01_0121__en-us_topic_0000001309709789_b2666125135918">my_label</strong>": {
"type": "text"
}
}
}
}</pre>
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="css_01_0121__en-us_topic_0000001309709789_table189861827103114" frame="border" border="1" rules="all"><caption><b>Table 1 </b>Parameters for creating an index</caption><thead align="left"><tr id="css_01_0121__en-us_topic_0000001309709789_row313720280311"><th align="left" class="cellrowborder" valign="top" width="20.75%" id="mcps1.3.2.2.3.4.2.4.1.1"><p id="css_01_0121__en-us_topic_0000001309709789_p513762803116">Type</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="17.57%" id="mcps1.3.2.2.3.4.2.4.1.2"><p id="css_01_0121__en-us_topic_0000001309709789_p161374285318">Parameter</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="61.68%" id="mcps1.3.2.2.3.4.2.4.1.3"><p id="css_01_0121__en-us_topic_0000001309709789_p15137828193115">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="css_01_0121__en-us_topic_0000001309709789_row813742811312"><td class="cellrowborder" valign="top" width="20.75%" headers="mcps1.3.2.2.3.4.2.4.1.1 "><p id="css_01_0121__en-us_topic_0000001309709789_p913772817312">Index settings parameters</p>
</td>
<td class="cellrowborder" valign="top" width="17.57%" headers="mcps1.3.2.2.3.4.2.4.1.2 "><p id="css_01_0121__en-us_topic_0000001309709789_p21379285311">vector</p>
</td>
<td class="cellrowborder" valign="top" width="61.68%" headers="mcps1.3.2.2.3.4.2.4.1.3 "><p id="css_01_0121__en-us_topic_0000001309709789_p161371728183114">To use a vector index, set this parameter to <strong id="css_01_0121__en-us_topic_0000001309709789_b116314376305">true</strong>.</p>
</td>
</tr>
<tr id="css_01_0121__en-us_topic_0000001309709789_row10137192819314"><td class="cellrowborder" rowspan="7" valign="top" width="20.75%" headers="mcps1.3.2.2.3.4.2.4.1.1 "><p id="css_01_0121__en-us_topic_0000001309709789_p213752833114">Field mappings parameters</p>
<p id="css_01_0121__p1178501092018"></p>
</td>
<td class="cellrowborder" valign="top" width="17.57%" headers="mcps1.3.2.2.3.4.2.4.1.2 "><p id="css_01_0121__en-us_topic_0000001309709789_p3137192833111">type</p>
</td>
<td class="cellrowborder" valign="top" width="61.68%" headers="mcps1.3.2.2.3.4.2.4.1.3 "><p id="css_01_0121__en-us_topic_0000001309709789_p10137528193113">Field type, for example, <strong id="css_01_0121__en-us_topic_0000001309709789_b9530854183018">vector</strong>.</p>
</td>
</tr>
<tr id="css_01_0121__en-us_topic_0000001309709789_row11137102816314"><td class="cellrowborder" valign="top" headers="mcps1.3.2.2.3.4.2.4.1.1 "><p id="css_01_0121__en-us_topic_0000001309709789_p9137162819314">dimension</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.3.2.2.3.4.2.4.1.2 "><p id="css_01_0121__en-us_topic_0000001309709789_p1813722813114">Vector dimension.</p>
<p id="css_01_0121__p1069515213391">The default value is <strong id="css_01_0121__b11206135173514">768</strong> and cannot be changed.</p>
<p id="css_01_0121__en-us_topic_0000001309709789_p413772863110">Value range: [1, 4096]</p>
</td>
</tr>
<tr id="css_01_0121__en-us_topic_0000001309709789_row11375285319"><td class="cellrowborder" valign="top" headers="mcps1.3.2.2.3.4.2.4.1.1 "><p id="css_01_0121__en-us_topic_0000001309709789_p41371928143113">indexing</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.3.2.2.3.4.2.4.1.2 "><p id="css_01_0121__en-us_topic_0000001309709789_p847320141736">Whether to enable vector index acceleration.</p>
<div class="p" id="css_01_0121__en-us_topic_0000001309709789_p1446833612412">The value can be:<ul id="css_01_0121__en-us_topic_0000001309709789_ul14231831846"><li id="css_01_0121__en-us_topic_0000001309709789_li172319311418"><strong id="css_01_0121__en-us_topic_0000001309709789_b625014417332">false</strong>: disables vector index acceleration. If this parameter is set to <strong id="css_01_0121__en-us_topic_0000001309709789_b67379254711">false</strong>, vector data is written only to docvalues, and only <strong id="css_01_0121__en-us_topic_0000001309709789_b119511914184717">ScriptScore</strong> and <strong id="css_01_0121__en-us_topic_0000001309709789_b1861413177470">Rescore</strong> can be used for vector query.</li><li id="css_01_0121__en-us_topic_0000001309709789_li1923123120417"><strong id="css_01_0121__en-us_topic_0000001309709789_b615071043520">true</strong>: enables vector index acceleration. If this parameter is set to <strong id="css_01_0121__en-us_topic_0000001309709789_b15891938124717">true</strong>, an extra vector index is created. The index algorithm is specified by the <strong id="css_01_0121__en-us_topic_0000001309709789_b789517615277">algorithm</strong> field and <strong id="css_01_0121__en-us_topic_0000001309709789_b1068645124815">VectorQuery</strong> can be used for data query.</li></ul>
</div>
<p id="css_01_0121__en-us_topic_0000001309709789_p9137192817313">Default value: <strong id="css_01_0121__en-us_topic_0000001309709789_b20324114311420">false</strong></p>
</td>
</tr>
<tr id="css_01_0121__en-us_topic_0000001309709789_row17137928133115"><td class="cellrowborder" valign="top" headers="mcps1.3.2.2.3.4.2.4.1.1 "><p id="css_01_0121__en-us_topic_0000001309709789_p20137928103120">algorithm</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.3.2.2.3.4.2.4.1.2 "><p id="css_01_0121__en-us_topic_0000001309709789_p31371028153117">Index algorithm. This parameter is valid only when <span class="parmname" id="css_01_0121__en-us_topic_0000001309709789_parmname1892551140"><b>indexing</b></span> is set to <span class="parmvalue" id="css_01_0121__en-us_topic_0000001309709789_parmvalue34381757842"><b>true</b></span>.</p>
<div class="p" id="css_01_0121__en-us_topic_0000001309709789_p59041981956">The value can be:<ul id="css_01_0121__en-us_topic_0000001309709789_ul13137192843118"><li id="css_01_0121__en-us_topic_0000001309709789_li9137102883117"><strong id="css_01_0121__en-us_topic_0000001309709789_b942753614917">FLAT</strong>: brute-force algorithm that calculates the distance between the target vector and all vectors in sequence. The algorithm relies on sheer computing power and its recall rate reaches 100%. You can use this algorithm if you require high recall accuracy.</li><li id="css_01_0121__en-us_topic_0000001309709789_li1013752814316"><strong id="css_01_0121__en-us_topic_0000001309709789_b167036388535">GRAPH</strong>: Hierarchical Navigable Small Worlds (HNSW) algorithm for graph indexes. This algorithm is mainly used in scenarios where high performance and precision are required and the data records of a single shard is fewer than 10 million.</li><li id="css_01_0121__en-us_topic_0000001309709789_li9138128173111"><strong id="css_01_0121__en-us_topic_0000001309709789_b14902418538">GRAPH_PQ</strong>: combination of the HNSW algorithm and the PQ algorithm. The PQ algorithm reduces the storage overhead of original vectors, so that HNSW can easily search for data among hundreds of millions of records.</li><li id="css_01_0121__en-us_topic_0000001309709789_li3138142873115"><strong id="css_01_0121__en-us_topic_0000001309709789_b6567184835312">IVF_GRAPH</strong>: combination of IVF and HNSW. The entire space is divided into multiple cluster centroids, which makes search much faster but slightly inaccurate. You can use this algorithm if you require high performance when searching for data among hundreds of millions of records.</li><li id="css_01_0121__en-us_topic_0000001309709789_li11138112811312"><strong id="css_01_0121__en-us_topic_0000001309709789_b1399065715531">IVF_GRAPH_PQ</strong>: combination of the PQ algorithm with the IVF or HNSW algorithm to further improve the system capacity and reduce the system overhead. This algorithm is applicable to scenarios where there are more than 1 billion files in shards and high retrieval performance is required.</li></ul>
</div>
<div class="p" id="css_01_0121__en-us_topic_0000001309709789_p1992814222519">Default value: <strong id="css_01_0121__en-us_topic_0000001309709789_b138150105413">GRAPH</strong><div class="note" id="css_01_0121__en-us_topic_0000001309709789_note49515161850"><span class="notetitle"> NOTE: </span><div class="notebody"><p id="css_01_0121__en-us_topic_0000001309709789_p19955161253">If <strong id="css_01_0121__en-us_topic_0000001309709789_b44612345416">IVF_GRAPH</strong> or <strong id="css_01_0121__en-us_topic_0000001309709789_b194619375415">IVF_GRAPH_PQ</strong> is specified, you need to pre-build and register a central point index. For details, see <a href="css_01_0124.html">(Optional) Pre-Building and Registering a Center Point Vector</a>.</p>
</div></div>
</div>
</td>
</tr>
<tr id="css_01_0121__en-us_topic_0000001309709789_row17361132932517"><td class="cellrowborder" valign="top" headers="mcps1.3.2.2.3.4.2.4.1.1 "><p id="css_01_0121__en-us_topic_0000001309709789_p1361102910258"><a href="#css_01_0121__en-us_topic_0000001309709789_table9916164920432">Table 2</a></p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.3.2.2.3.4.2.4.1.2 "><p id="css_01_0121__en-us_topic_0000001309709789_p3361172917256">If <strong id="css_01_0121__en-us_topic_0000001309709789_b3324653161317">Indexing</strong> is set to <strong id="css_01_0121__en-us_topic_0000001309709789_b1737844601310">true</strong>, CSS provides optional parameters for vector search to achieve higher query performance or precision.</p>
</td>
</tr>
<tr id="css_01_0121__en-us_topic_0000001309709789_row1138828193117"><td class="cellrowborder" valign="top" headers="mcps1.3.2.2.3.4.2.4.1.1 "><p id="css_01_0121__en-us_topic_0000001309709789_p16138152843114">metric</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.3.2.2.3.4.2.4.1.2 "><p id="css_01_0121__en-us_topic_0000001309709789_p12803936171619">Method of calculating the distance between vectors.</p>
<p id="css_01_0121__en-us_topic_0000001309709789_p580012449167">The value can be:</p>
<ul id="css_01_0121__en-us_topic_0000001309709789_ul275905161620"><li id="css_01_0121__en-us_topic_0000001309709789_li3759195117167"><strong id="css_01_0121__en-us_topic_0000001309709789_b953552252020">euclidean</strong>: Euclidean distance</li><li id="css_01_0121__en-us_topic_0000001309709789_li1976613910173"><strong id="css_01_0121__en-us_topic_0000001309709789_b164051531122016">inner_product</strong>: inner product distance</li><li id="css_01_0121__en-us_topic_0000001309709789_li2983719191718"><strong id="css_01_0121__en-us_topic_0000001309709789_b13235738214">cosine</strong>: cosine distance</li><li id="css_01_0121__en-us_topic_0000001309709789_li116272039161717"><strong id="css_01_0121__b012910347284">hamming</strong>: Hamming distance, which can be used only when <strong id="css_01_0121__b579114032913">dim_type</strong> is set to <strong id="css_01_0121__b1782318812919">binary</strong>.</li></ul>
<p id="css_01_0121__en-us_topic_0000001309709789_p713810288312">Default value: <strong id="css_01_0121__en-us_topic_0000001309709789_b15773612162113">euclidean</strong></p>
</td>
</tr>
<tr id="css_01_0121__row167855103202"><td class="cellrowborder" valign="top" headers="mcps1.3.2.2.3.4.2.4.1.1 "><p id="css_01_0121__p478561011201">dim_type</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.3.2.2.3.4.2.4.1.2 "><p id="css_01_0121__p778531016206">Type of the vector dimension value.</p>
<p id="css_01_0121__p13376105710208">The value can be <strong id="css_01_0121__b10392152192818">binary</strong> and <strong id="css_01_0121__b11876236282">float</strong> (default).</p>
</td>
</tr>
</tbody>
</table>
</div>
<div class="tablenoborder"><a name="css_01_0121__en-us_topic_0000001309709789_table9916164920432"></a><a name="en-us_topic_0000001309709789_table9916164920432"></a><table cellpadding="4" cellspacing="0" summary="" id="css_01_0121__en-us_topic_0000001309709789_table9916164920432" frame="border" border="1" rules="all"><caption><b>Table 2 </b>Optional parameters</caption><thead align="left"><tr id="css_01_0121__en-us_topic_0000001309709789_row13952749114315"><th align="left" class="cellrowborder" valign="top" width="15.15%" id="mcps1.3.2.2.3.5.2.4.1.1"><p id="css_01_0121__en-us_topic_0000001309709789_p169521949154312">Type</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="26.82%" id="mcps1.3.2.2.3.5.2.4.1.2"><p id="css_01_0121__en-us_topic_0000001309709789_p109521249144312">Parameter</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="58.03%" id="mcps1.3.2.2.3.5.2.4.1.3"><p id="css_01_0121__en-us_topic_0000001309709789_p1695214913438">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="css_01_0121__en-us_topic_0000001309709789_row49522492436"><td class="cellrowborder" rowspan="5" valign="top" width="15.15%" headers="mcps1.3.2.2.3.5.2.4.1.1 "><p id="css_01_0121__en-us_topic_0000001309709789_p13952144974312">Graph index configuration parameters</p>
</td>
<td class="cellrowborder" valign="top" width="26.82%" headers="mcps1.3.2.2.3.5.2.4.1.2 "><p id="css_01_0121__en-us_topic_0000001309709789_p395214916432">neighbors</p>
</td>
<td class="cellrowborder" valign="top" width="58.03%" headers="mcps1.3.2.2.3.5.2.4.1.3 "><p id="css_01_0121__en-us_topic_0000001309709789_p146721318450">Number of neighbors of each vector in a graph index. The default value is <strong id="css_01_0121__en-us_topic_0000001309709789_b9758163472320">64</strong>. A larger value indicates higher query precision. A larger index results in a slower build and query speed.</p>
<p id="css_01_0121__en-us_topic_0000001309709789_p195264919438">Value range: [10, 255]</p>
</td>
</tr>
<tr id="css_01_0121__en-us_topic_0000001309709789_row10952184915433"><td class="cellrowborder" valign="top" headers="mcps1.3.2.2.3.5.2.4.1.1 "><p id="css_01_0121__en-us_topic_0000001309709789_p10952449134318">shrink</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.3.2.2.3.5.2.4.1.2 "><p id="css_01_0121__en-us_topic_0000001309709789_p42315159456">Cropping coefficient during HNSW build. The default value is <strong id="css_01_0121__en-us_topic_0000001309709789_b10850144952615">1.0f</strong>.</p>
<p id="css_01_0121__en-us_topic_0000001309709789_p13952144910430">Value range: (0.1, 10)</p>
</td>
</tr>
<tr id="css_01_0121__en-us_topic_0000001309709789_row12952134919436"><td class="cellrowborder" valign="top" headers="mcps1.3.2.2.3.5.2.4.1.1 "><p id="css_01_0121__en-us_topic_0000001309709789_p29521749194312">scaling</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.3.2.2.3.5.2.4.1.2 "><p id="css_01_0121__en-us_topic_0000001309709789_p6353141934511">Scaling ratio of the upper-layer graph nodes during HNSW build. The default value is <strong id="css_01_0121__en-us_topic_0000001309709789_b1097719110314">50</strong>.</p>
<p id="css_01_0121__en-us_topic_0000001309709789_p79527493437">Value range: (0, 128]</p>
</td>
</tr>
<tr id="css_01_0121__en-us_topic_0000001309709789_row12952249194310"><td class="cellrowborder" valign="top" headers="mcps1.3.2.2.3.5.2.4.1.1 "><p id="css_01_0121__en-us_topic_0000001309709789_p1695284974314">efc</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.3.2.2.3.5.2.4.1.2 "><p id="css_01_0121__en-us_topic_0000001309709789_p1449215201459">Queue size of the neighboring node during HNSW build. The default value is <strong id="css_01_0121__en-us_topic_0000001309709789_b3697122563810">200</strong>. A larger value indicates a higher precision and slower build speed.</p>
<p id="css_01_0121__en-us_topic_0000001309709789_p7952349194313">Value range: (0, 100000]</p>
</td>
</tr>
<tr id="css_01_0121__en-us_topic_0000001309709789_row1495216496438"><td class="cellrowborder" valign="top" headers="mcps1.3.2.2.3.5.2.4.1.1 "><p id="css_01_0121__en-us_topic_0000001309709789_p119529494438">max_scan_num</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.3.2.2.3.5.2.4.1.2 "><p id="css_01_0121__p12112134410225">Maximum number of nodes that can be scanned. The default value is <strong id="css_01_0121__en-us_topic_0000001309709789_b671013723910">10000</strong>. A larger value indicates a higher precision and slower indexing speed.</p>
<p id="css_01_0121__en-us_topic_0000001309709789_p10952114944310">Value range: (0, 1000000]</p>
</td>
</tr>
<tr id="css_01_0121__en-us_topic_0000001309709789_row1395216498438"><td class="cellrowborder" rowspan="2" valign="top" width="15.15%" headers="mcps1.3.2.2.3.5.2.4.1.1 "><p id="css_01_0121__en-us_topic_0000001309709789_p18952194914431">PQ index configuration parameters</p>
</td>
<td class="cellrowborder" valign="top" width="26.82%" headers="mcps1.3.2.2.3.5.2.4.1.2 "><p id="css_01_0121__en-us_topic_0000001309709789_p0952149114312">centroid_num</p>
</td>
<td class="cellrowborder" valign="top" width="58.03%" headers="mcps1.3.2.2.3.5.2.4.1.3 "><p id="css_01_0121__en-us_topic_0000001309709789_p442382274517">Number of cluster centroids of each fragment. The default value is <strong id="css_01_0121__en-us_topic_0000001309709789_b196566171407">255</strong>.</p>
<p id="css_01_0121__en-us_topic_0000001309709789_p1095234911438">Value range: (0, 65535]</p>
</td>
</tr>
<tr id="css_01_0121__en-us_topic_0000001309709789_row795254913434"><td class="cellrowborder" valign="top" headers="mcps1.3.2.2.3.5.2.4.1.1 "><p id="css_01_0121__en-us_topic_0000001309709789_p395294915433">fragment_num</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.3.2.2.3.5.2.4.1.2 "><p id="css_01_0121__en-us_topic_0000001309709789_p1631132312459">Number of fragments. The default value is <strong id="css_01_0121__en-us_topic_0000001309709789_b87741752134011">0</strong>. The plug-in automatically sets the number of fragments based on the vector length.</p>
<p id="css_01_0121__en-us_topic_0000001309709789_p1495284910437">Value range: [0, 4096]</p>
</td>
</tr>
</tbody>
</table>
</div>
</li></ol>
</div>
<div class="section" id="css_01_0121__en-us_topic_0000001309709789_section137931314240"><a name="css_01_0121__en-us_topic_0000001309709789_section137931314240"></a><a name="en-us_topic_0000001309709789_section137931314240"></a><h4 class="sectiontitle">Importing Vector Data</h4><p id="css_01_0121__en-us_topic_0000001309709789_p124892526317">Run the following command to import vector data. When writing vector data to the <strong id="css_01_0121__en-us_topic_0000001309709789_b4171132984217">my_index</strong> index, you need to specify the vector field name and vector data.</p>
<ul id="css_01_0121__en-us_topic_0000001309709789_ul14457177133419"><li id="css_01_0121__en-us_topic_0000001309709789_li134576710342">If the input vector data is an array of floating-point numbers separated by commas (,):<pre class="screen" id="css_01_0121__en-us_topic_0000001309709789_screen122366212715">POST my_index/_doc
{
"my_vector": <em id="css_01_0121__i148491717241">[1.0, 2.0]</em>
}</pre>
</li></ul>
<ul id="css_01_0121__en-us_topic_0000001309709789_ul2023361373419"><li id="css_01_0121__en-us_topic_0000001309709789_li1823312136345">If the input vector data is a Base64 string encoded using little endian:<div class="p" id="css_01_0121__en-us_topic_0000001309709789_p18887114863414"><a name="css_01_0121__en-us_topic_0000001309709789_li1823312136345"></a><a name="en-us_topic_0000001309709789_li1823312136345"></a>When writing binary vectors or high dimensional vectors that have a large number of valid bits, the Base64 encoding format is efficient for data transmission and parsing.<pre class="screen" id="css_01_0121__en-us_topic_0000001309709789_screen13775245173413">POST my_index/_doc
{
"my_vector": <em id="css_01_0121__en-us_topic_0000001309709789_i17751645123420">"AACAPwAAAEA="</em>
}</pre>
</div>
</li><li id="css_01_0121__en-us_topic_0000001309709789_li9687175817347">To write a large amount of data, bulk operations are recommended.<pre class="screen" id="css_01_0121__en-us_topic_0000001309709789_screen17698287350">POST my_index/_bulk
{"index": {}}
{"my_vector": <em id="css_01_0121__en-us_topic_0000001309709789_i1374193123516">[1.0, 2.0]</em>, "my_label": "<em id="css_01_0121__en-us_topic_0000001309709789_i33288398359">red</em>"}
{"index": {}}
{"my_vector": <em id="css_01_0121__en-us_topic_0000001309709789_i7718933113512">[2.0, 2.0]</em>, "my_label": "<em id="css_01_0121__en-us_topic_0000001309709789_i1114542173514">green</em>"}
{"index": {}}
{"my_vector": <em id="css_01_0121__en-us_topic_0000001309709789_i676403614353">[2.0, 3.0]</em>, "my_label": "<em id="css_01_0121__en-us_topic_0000001309709789_i11636114583519">red</em>"}</pre>
</li></ul>
</div>
<div class="section" id="css_01_0121__en-us_topic_0000001309709789_section8992201842518"><a name="css_01_0121__en-us_topic_0000001309709789_section8992201842518"></a><a name="en-us_topic_0000001309709789_section8992201842518"></a><h4 class="sectiontitle">Advanced Cluster Configurations</h4><ul id="css_01_0121__en-us_topic_0000001309709789_ul15987041576"><li id="css_01_0121__en-us_topic_0000001309709789_li14987041175">When importing data offline, you are advised to set <strong id="css_01_0121__en-us_topic_0000001309709789_b118111940175310">refresh_interval</strong> of indexes to <strong id="css_01_0121__en-us_topic_0000001309709789_b125129558535">-1</strong> to disable automatic index refreshing and improve batch write performance.</li><li id="css_01_0121__en-us_topic_0000001309709789_li10987184111711">You are advised to set <strong id="css_01_0121__en-us_topic_0000001309709789_b1450119367545">number_of_replicas</strong> to <strong id="css_01_0121__en-us_topic_0000001309709789_b27014380546">0</strong>. After the offline data import is complete, you can modify the parameter value as needed.</li><li id="css_01_0121__en-us_topic_0000001309709789_li15567154814461">The parameters of other advanced functions as follows:
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="css_01_0121__en-us_topic_0000001309709789_table14840054154616" frame="border" border="1" rules="all"><caption><b>Table 3 </b>Cluster parameters</caption><thead align="left"><tr id="css_01_0121__en-us_topic_0000001309709789_row10840205444620"><th align="left" class="cellrowborder" valign="top" width="28.07%" id="mcps1.3.4.2.3.1.2.3.1.1"><p id="css_01_0121__en-us_topic_0000001309709789_p11840195417463">Parameter</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="71.93%" id="mcps1.3.4.2.3.1.2.3.1.2"><p id="css_01_0121__en-us_topic_0000001309709789_p584045412460">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="css_01_0121__en-us_topic_0000001309709789_row1984014541461"><td class="cellrowborder" valign="top" width="28.07%" headers="mcps1.3.4.2.3.1.2.3.1.1 "><p id="css_01_0121__en-us_topic_0000001309709789_p1184012542463">native.cache.circuit_breaker.enabled</p>
</td>
<td class="cellrowborder" valign="top" width="71.93%" headers="mcps1.3.4.2.3.1.2.3.1.2 "><p id="css_01_0121__en-us_topic_0000001309709789_p1884010543460">Whether to enable the circuit breaker for off-heap memory.</p>
<p id="css_01_0121__en-us_topic_0000001309709789_p108401554134616">Default value: <strong id="css_01_0121__en-us_topic_0000001309709789_b89731322195010">true</strong></p>
</td>
</tr>
<tr id="css_01_0121__en-us_topic_0000001309709789_row2084025454614"><td class="cellrowborder" valign="top" width="28.07%" headers="mcps1.3.4.2.3.1.2.3.1.1 "><p id="css_01_0121__en-us_topic_0000001309709789_p198401754104612">native.cache.circuit_breaker.cpu.limit</p>
</td>
<td class="cellrowborder" valign="top" width="71.93%" headers="mcps1.3.4.2.3.1.2.3.1.2 "><p id="css_01_0121__en-us_topic_0000001309709789_p8840165410464">Upper limit of off-heap memory usage of the vector index.</p>
<p id="css_01_0121__en-us_topic_0000001309709789_p14840145414615">For example, if the overall memory of a host is 128 GB and the heap memory occupies 31 GB, the default upper limit of the off-heap memory usage is 43.65 GB, that is, (128 - 31) x 45%. If the off-heap memory usage exceeds its upper limit, the circuit breaker will be triggered.</p>
<p id="css_01_0121__en-us_topic_0000001309709789_p1584075419469">Default value: <strong id="css_01_0121__en-us_topic_0000001309709789_b155402252505">45%</strong></p>
</td>
</tr>
<tr id="css_01_0121__en-us_topic_0000001309709789_row2840254184612"><td class="cellrowborder" valign="top" width="28.07%" headers="mcps1.3.4.2.3.1.2.3.1.1 "><p id="css_01_0121__en-us_topic_0000001309709789_p1084075424612">native.cache.expire.enabled</p>
</td>
<td class="cellrowborder" valign="top" width="71.93%" headers="mcps1.3.4.2.3.1.2.3.1.2 "><p id="css_01_0121__en-us_topic_0000001309709789_p14840454154620">Whether to enable the cache expiration policy. If this parameter is set to <strong id="css_01_0121__en-us_topic_0000001309709789_b15776141985717">true</strong>, some cache items that have not been accessed for a long time will be cleared.</p>
<p id="css_01_0121__en-us_topic_0000001309709789_p188403541465">Value: <strong id="css_01_0121__en-us_topic_0000001309709789_b2355142895016">true</strong> or <strong id="css_01_0121__en-us_topic_0000001309709789_b103561528135011">false</strong></p>
<p id="css_01_0121__en-us_topic_0000001309709789_p12840854134616">Default value: <strong id="css_01_0121__en-us_topic_0000001309709789_b16187123135018">false</strong></p>
</td>
</tr>
<tr id="css_01_0121__en-us_topic_0000001309709789_row1684035414620"><td class="cellrowborder" valign="top" width="28.07%" headers="mcps1.3.4.2.3.1.2.3.1.1 "><p id="css_01_0121__en-us_topic_0000001309709789_p2084016540466">native.cache.expire.time</p>
</td>
<td class="cellrowborder" valign="top" width="71.93%" headers="mcps1.3.4.2.3.1.2.3.1.2 "><p id="css_01_0121__en-us_topic_0000001309709789_p13840454124613">Expiration time.</p>
<p id="css_01_0121__en-us_topic_0000001309709789_p3840954104614">Default value: <strong id="css_01_0121__en-us_topic_0000001309709789_b127371257165018">24h</strong></p>
</td>
</tr>
<tr id="css_01_0121__en-us_topic_0000001309709789_row18840954194618"><td class="cellrowborder" valign="top" width="28.07%" headers="mcps1.3.4.2.3.1.2.3.1.1 "><p id="css_01_0121__en-us_topic_0000001309709789_p1684015418465">native.vector.index_threads</p>
</td>
<td class="cellrowborder" valign="top" width="71.93%" headers="mcps1.3.4.2.3.1.2.3.1.2 "><p id="css_01_0121__en-us_topic_0000001309709789_p14840105414463">Number of threads used for creating underlying indexes. Each shard uses multiple threads. Set a relatively small value to avoid resource preemption caused by the build queries of too many threads.</p>
<p id="css_01_0121__en-us_topic_0000001309709789_p48407544465">Default value: <strong id="css_01_0121__en-us_topic_0000001309709789_b9900175116">4</strong></p>
</td>
</tr>
</tbody>
</table>
</div>
</li></ul>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="css_01_0117.html">Vector Retrieval</a></div>
</div>
</div>