forked from docs/doc-exports
Reviewed-by: Pruthi, Vineet <vineet.pruthi@t-systems.com> Co-authored-by: zhengxiu <zhengxiu@huawei.com> Co-committed-by: zhengxiu <zhengxiu@huawei.com>
46 lines
3.7 KiB
HTML
46 lines
3.7 KiB
HTML
<a name="css_01_0468"></a><a name="css_01_0468"></a>
|
|
|
|
|
|
|
|
|
|
<h1 class="topictitle1">Optimizing the Write and Query Performance of Vector Search</h1>
|
|
<div id="body0000001992205805"><div class="section" id="css_01_0468__css_01_0126_en-us_topic_0000001262069744_section186411329173012"><h4 class="sectiontitle">Optimizing Write Performance</h4><ul id="css_01_0468__css_01_0126_en-us_topic_0000001262069744_ul09461057164113"><li id="css_01_0468__css_01_0126_en-us_topic_0000001262069744_li189761389357">To reduce the cost of backup, disable the backup function before data import and enable it afterwards.</li><li id="css_01_0468__css_01_0126_en-us_topic_0000001262069744_li27411942123713">Set <span class="parmname" id="css_01_0468__css_01_0126_en-us_topic_0000001262069744_parmname877971815344"><b>refresh_interval</b></span> to <strong id="css_01_0468__css_01_0126_en-us_topic_0000001262069744_b1176015317388">120s</strong> or a larger value. Larger segments can reduce the vector index build overhead caused by merging.</li><li id="css_01_0468__css_01_0126_en-us_topic_0000001262069744_li1053491484012">Increase the value of <span class="parmname" id="css_01_0468__css_01_0126_en-us_topic_0000001262069744_parmname18272105316343"><b>native.vector.index_threads</b></span> (the default value is <strong id="css_01_0468__css_01_0126_en-us_topic_0000001262069744_b11648194418458">4</strong>) to increase the number of threads for vector index build.<pre class="screen" id="css_01_0468__css_01_0126_en-us_topic_0000001262069744_screen28631532420">PUT _cluster/settings
|
|
{
|
|
"persistent": {
|
|
"native.vector.index_threads": 8
|
|
}
|
|
}</pre>
|
|
</li></ul>
|
|
</div>
|
|
<div class="section" id="css_01_0468__css_01_0126_en-us_topic_0000001262069744_section527113518302"><h4 class="sectiontitle">Optimizing Query Performance</h4><ul id="css_01_0468__css_01_0126_en-us_topic_0000001262069744_ul1388130134412"><li id="css_01_0468__css_01_0126_en-us_topic_0000001262069744_li1456725974318">After importing data in batches, you can run the <strong id="css_01_0468__css_01_0126_en-us_topic_0000001262069744_b168089591364">forcemerge</strong> command to improve the query efficiency.<pre class="screen" id="css_01_0468__css_01_0126_en-us_topic_0000001262069744_screen3998132772116">POST index_name/_forcemerge?max_num_segments=1</pre>
|
|
</li></ul>
|
|
<ul id="css_01_0468__css_01_0126_en-us_topic_0000001262069744_ul269911532210"><li id="css_01_0468__css_01_0126_en-us_topic_0000001262069744_li56213018222">If the off-heap memory required by the vector index exceeds the circuit breaker limit, index entry swap-in and swap-out occur, which affects the query performance. In this case, you can increase the circuit breaker threshold of off-heap memory.<pre class="screen" id="css_01_0468__css_01_0126_en-us_topic_0000001262069744_screen9611125582411">PUT _cluster/settings
|
|
{
|
|
"persistent": {
|
|
"native.cache.circuit_breaker.cpu.limit": "75%"
|
|
}
|
|
}</pre>
|
|
</li><li id="css_01_0468__css_01_0126_li148341156892">To fetch a small number of fields that support doc values, such as keywords and numerical fields, use the docvalue_fields parameter to specify the fields you want to fetch. This helps to reduce overhead during the fetch phase.<pre class="screen" id="css_01_0468__css_01_0126_en-us_topic_0000001268154489_screen1466920229569">POST my_index/_search
|
|
{
|
|
"size": 2,
|
|
"stored_fields": ["_none_"],
|
|
"docvalue_fields": ["my_label"],
|
|
"query": {
|
|
"vector": {
|
|
"my_vector": {
|
|
"vector": [1, 1],
|
|
"topk": 2
|
|
}
|
|
}
|
|
}
|
|
}</pre>
|
|
</li></ul>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<div class="familylinks">
|
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="css_01_0464.html">Configuring Vector Search for OpenSearch Clusters</a></div>
|
|
</div>
|
|
</div>
|
|
|