I have the following ES object:
{
"_index": "index_name",
"_type": "my_type",
"_id": "12345678-abcd-9012-efgh-3456ijkl7890"
"_source": {
"apps": [
{
"processName": "process_name_1",
"name": "app_name_1",
"VersionName": "version_1"
},
{
"processName": "process_name_2",
"name": "app_name_2",
"VersionName": "version_2"
}
]
}
}
I want to add another object to the "apps" array while keeping the existing data so it looks like the following:
{
"_index": "index_name",
"_type": "my_type",
"_id": "12345678-abcd-9012-efgh-3456ijkl7890"
"_source": {
"apps": [
{
"processName": "process_name_1",
"name": "app_name_1",
"VersionName": "version_1"
},
{
"processName": "process_name_2",
"name": "app_name_2",
"VersionName": "version_2"
},
{
"processName": "process_name_3",
"name": "app_name_3",
"VersionName": "version_3"
}
]
}
}
As you see, I only added a third "app" to these apps objects. I need to do this in Python using the elasticsearch module. All my attempts either overwrite the existing items or do not work. I tried using the "ctx._source.apps+= newapps" scripting, but with Python, it seems to just append a new object named "scripts" and the new data, alongside the "apps" object, instead of just add to the "apps" object. Any thoughts?