If i understand your question correcttly you want to update array inside the existing document.
There are 2 option:
you can send entire new json/document (with updated array) to index and it will replace exsiting document.
you can use script with upsert to updating document. Please check official document for upsert with script .
Below are some other link which will help you to resolved this:
groovy, elasticsearch
I have a requirement where I need to update(not append) existing values
within a list or array in Elastic Search.
Is this feature supported in elastic search?
For eg:
I have a field called jobs as part of my document
"jobs": [
{
"status": "InProgress",
"runId": 1,
"start_date": 2101112,
"orderId": "undefined"
},
{
"status": "InProgress",
"runId": 2,
"start_date": 2101112,
"orderId": "undefined"
},
],
and I am required to update the orderId for each job run to different
values…