Home > other >  ElasticDump transform
ElasticDump transform

Time:01-30

I am new to elastic search. I have to copy the index from one ElasticSearch server to another ES Server and I have to update some field values before inserting them into the destination server. I found we can use the elasticdump npm package but there are no examples found how to use the transform option provided by the elasticdump package. can someone please provide an example to use the transform

CodePudding user response:

With Elasticdump, you can migrate data from one cluster to another. You can also use Logstash or remote reindex API. But it's not possible to manipulate the data during migration with elasticdump.

You can use ingest_pipeline, and ingest the data while indexing in the destination cluster.

I recommend you use remote reindex and ingest_pipeline like the following.

#create an ingest pipeline

PUT _ingest/pipeline/my-pipeline
{
  "processors": [
    {
      "set": {
        "field": "my-long-field",
        "value": 10
      }
    },
    {
      "set": {
        "field": "my-boolean-field",
        "value": true
      }
    },
    {
      "lowercase": {
        "field": "my-keyword-field"
      }
    }
  ]
}

#reindex the data

POST _reindex
{
  "source": {
    "remote": {
      "host": "http://otherhost:9200",
      "username": "user",
      "password": "pass"
    },
    "index": "my-index-000001"
  },
  "dest": {
    "index": "my-new-index-000001",
    "pipeline": "my-pipeline"
  }
}
  • Related