I've created an index, and I'm trying to add one field. using this script:
POST test_kris_assignment/_update_by_query
{
"script": {
"source": "ctx._source.field1.field2_1 =10",
"lang": "painless"
},
"query": {
"match_all": {}
}
}
field1 and field2_1 fields don't exist, the idea it's to have field1 at parent levell and then values for fiels2_1, field2_2, field2_3.... at same child level. Thank you. The complete error:
{
"error": {
"root_cause": [
{
"type": "script_exception",
"reason": "runtime error",
"script_stack": [
"ctx._source.field1.field2_1.index1 =10",
" ^---- HERE"
],
"script": "ctx._source.field1.field2_1.index1 =10",
"lang": "painless"
}
],
"type": "script_exception",
"reason": "runtime error",
"script_stack": [
"ctx._source.field1.field2_1.index1 =10",
" ^---- HERE"
],
"script": "ctx._source.field1.field2_1.index1 =10",
"lang": "painless",
"caused_by": {
"type": "null_pointer_exception",
"reason": null
}
},
"status": 400
}