Following is a row from my bulk update http body
When i run the same for small set of records (100) the same works fine but if i trigger the for the entire DB the the valueTimestamp field always null where other values are updated fine.
{"update" :{"_index":"masterdata","_type":"_doc","_id":"6.50"}}
{"script" : {"lang":"painless","source": "if (!ctx._source.containsKey("assignedAttributes") &&
params.assignedAttributes != null && params.assignedAttributes.attributeId != null )
{ctx._source["assignedAttributes"] = new ArrayList(); }
if( params.assignedAttributes != null && params.assignedAttributes.attributeId != null )
{ int num = -1; for (int i =0; i = ctx._source.assignedAttributes.size(); i++)
{ if (ctx._source.assignedAttributes.get(i).attributeId != null && ctx._source.assignedAttributes.get(i).attributeId == params.assignedAttributes.attributeId )
{ num= i; break; } } if (num == -1)
{ ctx._source.assignedAttributes.add(params.assignedAttributes); return; }
else { ctx._source.assignedAttributes.set(num, params.assignedAttributes); } }
if(!ctx._source.containsKey("assignedAttributes"))
{ ctx._source.assignedAttributes = params.assignedAttributes; }","params":{"companyId":6,"customerId":50,"assignedAttributes":{"customerAttributeId":20391484,"attributeId":220,"valueDataType":"timestamp","valueTimestamp":["2021-02-09"]}}}}
mapping :
"mappings": {
"properties": {
"assignedAttributes": {
"type": "nested",
"dynamic": "false",
"properties": {
"attributeId": {
"type": "long",
"null_value": -999999
},
"customerAttributeId": {
"type": "long"
},
"dataType": {
"type": "text"
},
"valueBoolean": {
"type": "boolean",
"null_value": false
},
"valueDataType": {
"type": "text"
},
"valueDouble": {
"type": "double",
"null_value": -999999.0
},
"valueLong": {
"type": "long",
"null_value": -999999
},
"valueText": {
"type": "keyword",
"null_value": "NULL"
},
"valueTimestamp": {
"type": "date",
"format": "yyyy-MM-dd"
}
}
},
"companyId": {
"type": "long"
},
"customerId": {
"type": "long"
}
}
}