Update array is creating the string concatenation


(kondapallinaresh) #1

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


(system) #2