我正在使用 Javascript 庫并嘗試對檔案執行相當大的更新。我已經更改了查詢本身以及客戶端物件的超時值,但仍然得到一個似乎是 2 分鐘的超時值。下面是查詢。
const arrayOfStrings = [...]; // This array could be between 10-12k elements in size
await elasticClient.updateByQuery({
index: "main-index",
refresh: true,
conflicts:"proceed",
script: {
lang: "painless",
source: "ctx._source.status = \"1\"; ctx._source.entities = []; for(term in params.array) ctx._source.entities.add(term);",
params: {
"array": arrayOfStrings
}
},
query: {
"term": {
"parent_id": 'dgd39gd3-db3dg23879-d893gdg38-e23ed' // There could be upwards of 5000 documents that match this criteria
}
},
timeout: "5m"
});
同樣在彈性客戶端上,我也requestTimeout設定為“5m”。我可以理解為什么這個特定的查詢可能會超時,因為它將 12k 元素陣列應用于 5k 檔案上的欄位。但是,當我設定了更長的超時值時,我不明白為什么僅 2 分鐘后查詢就會超時。
uj5u.com熱心網友回復:
您需要在這里做的是通過查詢異步運行更新
await elasticClient.updateByQuery({
index: "main-index",
refresh: true,
conflicts:"proceed",
waitForCompletion: false <---- add this setting
然后您可以跟蹤異步運行的任務的進度。
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/467170.html
標籤:弹性搜索
