我正在嘗試在兩個 ElasticSearch 實體之間移動資料。有沒有辦法跳過目標索引中已經存在的檔案?
from opensearchpy import OpenSearch,RequestsHttpConnection, helpers
def reindex_data_to_data_curation_es(es_src, es_des):
try:
helpers.reindex(es_src, src_idx, tar_idx, target_client=es_des, query={'query': {'match_all': {}}})
except Exception as e:
print("timed out", str(e))
uj5u.com熱心網友回復:
您不能從源索引中跳過它們,但如果它們已經存在,則不能確保在目標索引中不覆寫它們。只需添加op_type: create設定即可不覆寫目標索引中的現有檔案:
helpers.reindex(es_src, src_idx, tar_idx, target_client=es_des, op_type='create', query={'query': {'match_all': {}}})
^
|
add this
轉載請註明出處,本文鏈接:https://www.uj5u.com/net/425452.html
