This is our nested document mapping:
{
"properties" :{
"user_id" :{"type": "integer"},
"images" : {
"type": "nested",
"properties": {
"image_path": {"type": "string"}
}
}
}
}
How it is indexed on ElasticSearch:
{
"_index": "flags",
"_type": "flag",
"_id": "1",
"_score": 1,
"_source": {
"user_id" : 2,
"images" : [
{"image_path" : "123456.jpg"},
{"image_path" : "789101.jpg"},
]
}
}
We want to modify the path of "123456.jpg" and, depending of the specific API that was called, return a specific image path (folders name are static and known, we want to concat those with the picture name).
Desired result "upload/asd/123456.jpg":
{
"_index": "flags",
"_type": "flag",
"_id": "1",
"_score": 1,
"_source": {
"user_id" : 2,
"images" : [
{"image_path" : "upload/asd/123456.jpg"},
{"image_path" : "upload/qwe/789101.jpg"},
]
}
}
I have tried Script_fields but it is not working with nested documents.