# Update array is creating the string concatenation

**URL:** https://discuss.elastic.co/t/update-array-is-creating-the-string-concatenation/14338
**Category:** Elasticsearch
**Created:** [November 10, 2013, 7:12am UTC](https://discuss.elastic.co/t/update-array-is-creating-the-string-concatenation/14338 "2013-11-10T07:12:51Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![kondapallinaresh](https://avatars.discourse-cdn.com/v4/letter/k/dec6dc/32.png) [@kondapallinaresh](https://discuss.elastic.co/u/kondapallinaresh)
#### Post date: [November 10, 2013, 7:12am UTC](https://discuss.elastic.co/t/update-array-is-creating-the-string-concatenation/14338/1 "2013-11-10T07:12:51Z")

</div>

Hi ,

```
When i try to update the array ,it is taking asa string concatenation

```

here is the code i am using

Index mapping :

"taxaccess" : {  
"\_id" : {  
"path" : "TAX\_NUMBER"  
},  
"properties" : {  
"TAX\_NUMBER" : {  
"type" : "string",  
"index" : "not\_analyzed",  
"store" : true,  
"omit\_norms" : true,  
"index\_options" : "docs"  
},  
"USER\_IDS" : {  
"type" : "string",  
"index" : "not\_analyzed",  
"store" : true,  
"omit\_norms" : true,  
"index\_options" : "docs"  
}  
}

initially i am loading the TAX\_NUMBER later i am udating using

client.prepareUpdate("index", "taxaccess",rs.getString("TAX\_NUMBER"))  
.setScript("ctx.\_source.USER\_IDS+= USER\_ID")  
.addScriptParam("USER\_ID", rs.getString("USER"))

for number 101  
i had three users  
user1  
user2  
user2  
i had run the update three times  
i am expecting USER\_IDS:["user1","user2","user3"]

but the result is USER\_IDS:user1user2user3

could you please help me out how i need to solve this

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [July 6, 2017, 2:07am UTC](https://discuss.elastic.co/t/update-array-is-creating-the-string-concatenation/14338/2 "2017-07-06T02:07:57Z")

</div>


