Partial Update Multi Level Nested Document

Hi

Using Elasticsearch 1.7.1, I have the following document structure

"_source" : {
"questions" : {
	"defaultQuestion" : {			
		"tag" : 0,
		"gid" : 0,
		"rid" : 0,
		"caption" : "SRID",			
	},
	"tableQuestion" : {
		"rows" : [{
				"ids" : {						
					"answerList" : ["3547", "3548"],						
					"tag" : "0",
					"caption" : "Accounts",						
				},
				"name" : {						
					"answerList" : ["Some Name"],						
					"tag" : "0",
					"caption" : "Name",						
				}
			}
		],
		"caption" : "BPI 1500541753537",
		"id" : 644251570,
		"tag" : ""
	}
},
"id" : "447722821"	
}

I want to add a new object in in questions.tableQuestion.rows. My current script is

{ "update": {"_id": "935663867", "_retry_on_conflict" : 3} }
{ "script" : "ctx._source.questions += param1", "params" : {"param1" : {"tableQuestion": {"rows" : [ NEWROWOBJECT ]}  } }}

This is replacing the existing object with the new one. Kindly suggest how to append it.

Thanks
Orijit

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.