I want to update the field of an indexed Elasticsearch document. In my case, this is a tag field. This is the code I have:
$es_client->update([
'index' => 'myappname',
'type' => 'page',
'id' => $page_id,
'body' => [
'doc' => [
'tags' => $tagsArray
]
]
]);
So, this will update my document by adding an array of tags to it, but it will not delete the old tags. How can I make sure that old tags are deleted when new tags are added?
I looked through the documentation, but as we all know, Elasticsearch documents can be very confusing and overwhelming. So I ask here after a few days of searching.
Any help or advice is appreciated.
source
share