java将嵌套文档添加到嵌套文档数组中
我想不出一种方法来将嵌套文档添加到现有的嵌套文档数组中(如果为空,则创建该数组)
我的映射看起来像:
{
"example" : {
"properties" : {
"name" : { "type" : "string", "index" : "not_analyzed" },
"pets" : {
"type" : "nested",
"properties": {
"name" : {"type": "string", "index": "not_analyzed" },
"type" : {"type": "string", "index": "not_analyzed" }
}
}
}
}
}
# 1 楼答案
如果使用^{} ,则必须重新索引整个文档以添加另一个嵌套文档。下面是一个例子:
根据您的用例,您可能希望改为使用parent/child relationship进行调查