Is there a way to append term into an array of values?
For example if my document looks like this:
{
"items": ["item1", "item2", "item3"]
}
I want to append "item4" and "item5" to it.
I must do it in 2 queries? one to load the current list of values, and on to update that list? or is there more elegant way that will let me append those items in one query?
I am trying to do it with elastic4s like this:
client.execute(ElasticDsl.update id id in indexName / documentType script {
script(s"ctx._source.items += tag").params(Map("tag"->"item4"))
})
In order to use the above code snippet, I need to enable groovy scripts, and I am not sure how to do it with multiple items.
Any idea?