# Opensearch adding new value to the old one

**URL:** <https://forum.opensearch.org/t/opensearch-adding-new-value-to-the-old-one/16410>\
**Category:** OpenSearch\
**Tags:** configure\
**Created:** [October 24, 2023, 9:57am UTC](https://forum.opensearch.org/t/opensearch-adding-new-value-to-the-old-one/16410 "2023-10-24T09:57:52Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![DanilaCigan](https://avatars.discourse-cdn.com/v4/letter/d/b77776/32.png) [@DanilaCigan](https://forum.opensearch.org/u/DanilaCigan)\
**Post date:** [October 24, 2023, 9:57am UTC](https://forum.opensearch.org/t/opensearch-adding-new-value-to-the-old-one/16410/1 "2023-10-24T09:57:52Z")

</div>

**Versions** (relevant - OpenSearch/Dashboard/Server OS/Browser):  
opensearch 2.8.0

**Describe the issue** :  
I have an opensearch and logstash stack; logstash sending logs from the base and i need to not just replace old values(that’s already works with method update in logstash and templates in opensearch), but adding new to them(something like concatenation).  
Is it possible?

**Configuration** :

**Relevant Logs or Screenshots** :

---

<div class="post-metadata">

**Author:** ![gaobinlong](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.opensearch.org/gaobinlong/32/5242_2.png) [@gaobinlong](https://forum.opensearch.org/u/gaobinlong)\
**Post date:** [October 25, 2023, 2:13pm UTC](https://forum.opensearch.org/t/opensearch-adding-new-value-to-the-old-one/16410/2 "2023-10-25T14:13:37Z")

</div>

You can use the update API of OpenSearch to append a value to an existing array field, like this:

```auto
POST test/_update/1
{
  "script": {
    "source": "ctx._source.tags.add(params.tag)",
    "lang": "painless",
    "params": {
      "tag": "blue"
    }
  }
}

```
