using script update object field , unsupported_operation_exception occors.
elasticsearch version 7.10.
PUT script_test/
{
"mappings" : {
"dynamic" : "strict",
"properties" : {
"batch_name" : {
"type" : "keyword"
},
"course_source_jx_cnt" : {
"dynamic" : "true",
"properties" : {
"course_total_cnt" : {
"type" : "long"
}
}
}
}
},
"settings" : {
"number_of_shards": 4,
"number_of_replicas": 0,
"refresh_interval": "20s"
}
}
DELETE script_test/_doc/3
POST script_test/_create/3
{
"batch_name" : "app_rby_landing_middle"
}
GET script_test/_doc/3
POST script_test/_update/3
{
"script": {
"lang": "painless",
"source": "if(ctx._source.course_source_jx_cnt == null){ctx._source.course_source_jx_cnt = params.exam_answer_default;} ctx._source.course_source_jx_cnt.course_total_cnt=params.course_total_cnt ",
"params": {"exam_answer_default":{}}
}
}
errors:
{
"error" : {
"root_cause" : [
{
"type" : "illegal_argument_exception",
"reason" : "failed to execute script"
}
],
"type" : "illegal_argument_exception",
"reason" : "failed to execute script",
"caused_by" : {
"type" : "script_exception",
"reason" : "runtime error",
"script_stack" : [
"java.base/java.util.AbstractMap.put(AbstractMap.java:209)",
"ctx._source.course_source_jx_cnt.course_total_cnt=params.course_total_cnt ",
" ^---- HERE"
],
"script" : "if(ctx._source.course_source_jx_cnt == null){ctx._source.course_source_jx_cnt = params.exam_answer_default;} ctx._source.course_source_jx_cnt.course_total_cnt=params.course_total_cnt ",
"lang" : "painless",
"position" : {
"offset" : 142,
"start" : 110,
"end" : 184
},
"caused_by" : {
"type" : "unsupported_operation_exception",
"reason" : "unsupported_operation_exception: null"
}
}
},
"status" : 400
}