Here is a way to do it:
POST _ingest/pipeline/_simulate
{
"pipeline" :{
"description": "date pipeline ",
"processors": [
{
"script": {
"source": """
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
ctx.person.birthDate = format.format(format.parse(ctx.person.birthDate));
"""
}
}
]},
"docs": [
{
"_index": "index",
"_type": "_doc",
"_id": "id",
"_source": {
"person": {
"birthDate": "1950-01-01T12:00:00.000Z"
}
}
}
]
}
This gives:
{
"docs" : [
{
"doc" : {
"_index" : "index",
"_type" : "_doc",
"_id" : "id",
"_source" : {
"person" : {
"birthDate" : "1950-01-01"
}
},
"_ingest" : {
"timestamp" : "2019-02-26T17:35:45.52603Z"
}
}
}
]
}
HTH