Edited at

Elasticsearch : How to rename a field


How to Rename an Elasticsearch field


  • from

    columns:

- {name: xxx, type: double}


  • to

    columns:

- {name: yyy, type: double}


Pipeline API and reindex


  • create a new Pipeline API : Rename Processor

PUT _ingest/pipeline/pipeline_rename_xxx

{
"description" : "rename xxx",
"processors" : [
{
"rename": {
"field": "xxx",
"target_field": "yyy"
}
}
]
}

{

"acknowledged": true
}


  • then reindex

POST _reindex

{
"source": {
"index": "source"
},
"dest": {
"index": "dest",
"pipeline": "pipeline_rename_xxx"
}
}


References