Cannot set property on null object


#1

Hey guys,
I'm seeing this error on some of the document updates.

{Reason: failed to execute script, Caused by: {"caused_by":{"reason":"Cannot set property 'viewed' on null object","type":"null_pointer_exception"},"reason":"failed to run inline script [ctx._source.views[index]['viewed'] = true; ctx._source.views[index]['viewed_time'] = view_time] using lang [groovy]","type":"groovy_script_execution_exception"}}

I'm trying to modify the following document which exists in database(Index: view-2016-2-2_18, Type: 16, Id: 14544394458810440750)

{
"_index": "view-2016-2-2_18",
"_type": "16",
"_id": "14544394458810440750",
"_version": 2,
"_ttl": 85682770,
"found": true,
"_source": {
"id": "1-0-1454439445881044075",
"isExternal": true,
"networkId": "16",
"currency": "",
"received": "2016-02-02T18:57:25.881044075Z",
"responsed": "2016-02-02T18:57:25.883277647Z",
"response_time": 2233572,
"status_code": 2,
"views": [{
"view-id": 0,
"viewed": true,
"view_time": 1454439445883546015
}],
"site-id": "2791",
"site-language": "en",
"device-language": "en",
"device-ip": "XXX.XXX.XXX.XXX",
"device-os": "Windows 7",
"device-country": "US",
"device-region": "WI",
"device-city": "Madison",
"device-computed-type": "desktop",
"device-computed-os": "windows",
"device-location": "43.0761,-89.41",
"user-id": "XYZXYZXYZXYZXYZ"
}
}

It doesn't seem to fail in all cases, but there are intermittent fails from time to time (around 5-10%). Anyone know what's possibly causing this error?


(system) #2