-
Notifications
You must be signed in to change notification settings - Fork 25.8k
Painless null pointer exception #24695
Copy link
Copy link
Closed
Description
Document:
{
"_index": "optik",
"_type": "indicators",
"_id": "AVwPUXjQo8Mgt9lhybim",
"_score": 1,
"_routing": "test1",
"_parent": "test1",
"_source": {
"indicators_list": [
{
"indicator": "apple.com.au",
"ptag_type": "",
"ptag_analyst": "",
"ptag_date": "1970-01-01T00:00:00.000000"
}
]
}
}
Scripting:
POST optik/indicators/AVwPUXjQo8Mgt9lhybim/_update?parent=test1
{
"script": {
"lang": "painless",
"inline": "int i=0; for (i = 0; i < doc['indicators_list'].length; i++) { if (doc['indicators_list'][i]['indicator'].value == 'apple.com.au') { doc['indicators_list'][i]['ptag_type'].value = params.ptag_type;}}",
"params": {
"ptag_type": "malicious"
}
}
}
Error:
{
"error": {
"root_cause": [
{
"type": "remote_transport_exception",
"reason": "[h4M67tk][10.37.129.11:9300][indices:data/write/update[s]]"
}
],
"type": "illegal_argument_exception",
"reason": "failed to execute script",
"caused_by": {
"type": "script_exception",
"reason": "compile error",
"script_stack": [],
"script": "int i=0; for (i = 0; i < doc['indicators_list'].length; i++) { if (doc['indicators_list'][i]['indicator'].value == 'apple.com.au') { doc['indicators_list'][i]['ptag_type'].value = params.ptag_type;}}",
"lang": "painless",
"caused_by": {
"type": "null_pointer_exception",
"reason": null
}
}
},
"status": 400
}
Im at a dead end, would be nice to know where the null pointer is.. or why my script that is seemingly syntactically correct is failing..
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Type
Fields
Give feedbackNo fields configured for issues without a type.