Shiv Rajawat
Shiv Rajawat

Reputation: 988

Migrating Elasticsearch logs to a different cluster

I have an Elasticsearch deployment on Kubernetes (AKS). I'm using the official Elastic's docker images for deployments. Logs are being stored in a persistent Azure Disk. How can I migrate some of these logs to another cluster with a similar setup? Only those logs that matches a filter condition based on datetime of the logs needs to be migrated.

Upvotes: 0

Views: 460

Answers (1)

Sahil Gupta
Sahil Gupta

Reputation: 2166

Please use Reindex API for achieving the same

POST _reindex
{
  "source": {
    "remote": {
      "host": "http://oldhost:9200",
      "username": "user",
      "password": "pass"
    },
    "index": "source",
    "query": {
      "match": {
        "test": "data"
      }
    }
  },
  "dest": {
    "index": "dest"
  }
}

Note:

  1. Run the aforementioned command on your target instance.

  2. Make sure that the source instance is whitelisted in elasticsearch.yml

      reindex.remote.whitelist: oldhost:9200
    
  3. Run the process asynchronously using below query param

    POST _reindex?wait_for_completion=false 
    

Upvotes: 1

Related Questions