ElasticSearch - Append to integer array ElasticSearch - Append to integer array elasticsearch elasticsearch

ElasticSearch - Append to integer array


You should store first value as array (containing one value).Then you can use add() method.

POST /website/blog/1/_update{   "script" : "if (ctx._source.containsKey('tags')) { ctx._source.tags.add('next') } else { ctx._source.tags = ['first'] }"}