{
"doc": {
"properties": {
"biography": {
"properties": {
"en": {
"properties": {
"event": {
"type": "nested",
"properties": {
"id": {
"type": "long"
},
...
当我以后想添加一个新的
event
if (ctx._source.biography == null)
ctx._source.biography = new HashMap();
if (ctx._source.biography.${language} == null)
ctx._source.biography.${language} = new HashMap();
if (ctx._source.biography.${language}.event == null) {
ctx._source.biography.${language}.event = [ params.event ]
} else {
ctx._source.biography.${language}.event += [ params.event ]
}
有没有办法简化这些初始化步骤?