elasticsearch 複製索引

複製索引:

post _reindex
{
  "source": {
    "index": "i_alarm_count"
  },
  "dest": {
    "index": "blog"
  }
}

返回值:

{
"took": 19,
"timed_out": false,
"total": 9,
"updated": 9,
"created": 0,
"deleted": 0,
"batches": 1,
"version_conflicts": 0,
"noops": 0,
"retries": {
"bulk": 0,
"search": 0
},
"throttled_millis": 0,
"requests_per_second": -1,
"throttled_until_millis": 0,
"failures": [ ]
}

主要是備份數據 ,刪除索引 保留歷史數據等情況下可以使用

可以根據你的業務情況在source源中查詢部分滿足的數據複製到新的索引中;

post _reindex
{
  "source": {
    "index": "i_alarm_count",
    "type":"t_alarm_count",
    "query":{
        "term":{
            "title":"elasticsearch"
        }
    }
  },
  "dest": {
    "index": "blog",
    "type":"t_blog"
  }
}

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章