07 January 2021

elastic: salin doc dari index asal ke index lain (reindex)

salin semua doc ke index baru: (destination tak semestinya belum wujud)

POST /_reindex
{
  "source": {
    "index": "twitter"
  },
  "dest": {
    "index": "new_twitter"
  }
}


salin doc tertentu ke index baru:

POST /_reindex
{
  "source": {
    "index": "twitter",
    "query": {
      "term": {
        "user": "kimchy"
      }
    }
  },
  "dest": {
    "index": "new_twitter"
  }
}




ref: 

1- https://stackoverflow.com/questions/25144034/how-to-copy-some-elasticsearch-data-to-a-new-index

2- https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-reindex.html


No comments:

Post a Comment

Terima kasih