Just in case you are interest here is a sample ingest pipeline / simulate with various combinations
## Ingest Pipeline Concrete / Object
POST _ingest/pipeline/_simulate
{
"pipeline": {
"processors": [
{
"rename": {
"if": "ctx?.notes instanceof String",
"field": "notes",
"target_field": "notes.value",
"ignore_failure": false
}
}
]
},
"docs": [
{
"_source": {
"id": "8f22efb2-6a2a-4cb7-9d0b-01ca0d6cff2e",
"notes": {
"created_at": "2022/01/01",
"value": "This is some random note"
},
"first_name": "Some name",
"integration": "CRM_A"
}
},
{
"_source": {
"id": 1,
"notes": "This is a random note text",
"name": "Some random name",
"integration": "CRM_A"
}
},
{
"_source": {
"id": 1,
"name": "Some random name",
"integration": "CRM_A"
}
}
]
}
Results
{
"docs": [
{
"doc": {
"_index": "_index",
"_id": "_id",
"_version": "-3",
"_source": {
"integration": "CRM_A",
"notes": {
"created_at": "2022/01/01",
"value": "This is some random note"
},
"id": "8f22efb2-6a2a-4cb7-9d0b-01ca0d6cff2e",
"first_name": "Some name"
},
"_ingest": {
"timestamp": "2022-09-23T23:23:13.461958276Z"
}
}
},
{
"doc": {
"_index": "_index",
"_id": "_id",
"_version": "-3",
"_source": {
"name": "Some random name",
"integration": "CRM_A",
"id": 1,
"notes": {
"value": "This is a random note text"
}
},
"_ingest": {
"timestamp": "2022-09-23T23:23:13.461985402Z"
}
}
},
{
"doc": {
"_index": "_index",
"_id": "_id",
"_version": "-3",
"_source": {
"name": "Some random name",
"integration": "CRM_A",
"id": 1
},
"_ingest": {
"timestamp": "2022-09-23T23:23:13.461991898Z"
}
}
}
]
}