每个文档都有一个过于具体的特征数组:我想根据旧数组的值为每个文档创建(或更新)一个新数组。
示例文档:
{
"_index": li",
"_type": "profile",
"_id": "tqvatGQBhAqGE7-_7pdF",
"nonarrayfield":"person A",
"attributes": [
"California",
"human",
"abcdefg"
]
},
{
"_index": "li",
"_type": "profile",
"_id": "hqvatGQBhAqGE7-_7pRE",
"nonarrayfield":"person B",
"attributes": [
"Nevada",
"dolphin",
"zyx"
]
"new_attributes":[]
}
在此示例中,我想读取“属性”中的字符串值并创建/更新“ new_attributes”:
{
"_index": li",
"_type": "profile",
"_id": "tqvatGQBhAqGE7-_7pdF",
"nonarrayfield":"person A",
"attributes": [
"California",
"human",
"abcdefg"
]
,"new_attributes":[
"western_state",
"mammal"
]
},
{
"_index": "li",
"_type": "profile",
"_id": "hqvatGQBhAqGE7-_7pRE",
"nonarrayfield":"person B",
"attributes": [
"Nevada",
"dolphin",
"zyx"
]
,"new_attributes":[
"western_state",
"mammal"
]
}