Yes, just change the script to this:
"script": "ctx._source.update_field = (ctx._source.update_field + new_value).unique();"
We basically merge the two lists in groovy, and then with unique() we can remove all duplicates. Another way would be to make a list like Set , which will have the same effect.
source share