My \'doc\' request:
POST test_v2/_update/Z_nM_2wBjkGOA-r6ArOb
{
\"doc\": {
\"CD\": {
\"middle\": \"prakash\",
\"first\": \"raj\"
}
},
ctx._source['CD']=params.object1 ---> will update or add new field
POST test3/_update/30RaAG0BY3127H1HaOEv
{
"scripted_upsert":true,
"script": {
"lang": "painless",
"inline": "ctx._source['CD']=params.object1; if(!ctx._source.containsKey('comments')){ctx._source['comments']=[]}ctx._source.comments.add(params.object)",
"params": {
"object": {
"model": "tata nano",
"value": "2"
},
"object1": {
"middle": "prakash1",
"first": "raj1"
}
}
},
"upsert" : {}
}