I have a document like this
{
\"_index\": \"testindex\",
\"_type\": \"logs\",
\"_id\": \"1\",
\"_score\": 1,
\"_source\": {
\"field
The Request field does not yet exist in your documents, so your script needs to create it first:
POST _reindex
{
"source": {
"index": "testindex"
},
"dest": {
"index": "testindex1"
},
"script": {
"inline": "ctx._source.Request = [:]; ctx._source.Request.field3 = ctx._source.remove(\"field2\") ]"
}
}
Or a bit shorter like this:
POST _reindex
{
"source": {
"index": "testindex"
},
"dest": {
"index": "testindex1"
},
"script": {
"inline": "ctx._source.Request = [field3: ctx._source.remove(\"field2\") ]"
}
}