Hello community,
I am new to the elasticsearch and I am trying to get the last document from my index and update its list of object.
I tried several queries e.g:
POST localhost:9200/test-index/_update_by_query
{
"size":1,
"sort": [{"timestamp":"asc"}],
"script": {
"inline": "ctx._source.addresses.add(params.address)",
"params" : {
"address" :{
"street": "Yemen Road",
"number": 15,
"county": "Yemen"
}
}
}
}
But this updates all my documents. I guess that the script is applied before the size. I am stuck at this point and I would really like to do this in one API call.
What is the fastest way to do this?
Thank you in advance!