Consider the following document
{
"title": "My first blog entry",
"text": "Starting to get the hang of this...",
"tags": [ "testing" ],
"views": 0
}
I need to run kind of an upsert operation. If I encounter data like
{
"id": 1,
"tags": [ "new tag" ]
}
I want to update the existing document with same id. So result should be :
{
"id": 1,
"title": "My first blog entry",
"text": "Starting to get the hang of this...",
"tags": [ "testing", "new tag" ],
"views": 0
}
If the document with same id does not exist, I want to create a new one.
Now in databases like mongoDB, I could use update with $addToSet or $push operation. I could not find similar operation in Elasticsearch.
I read that it can be done by writing scripts in groovy. However, this needs to be done on a file containing 200 million records. I am not sure if I can use groovy in combination with bulk API. Is it possible ?