【发布时间】:2019-05-23 09:59:50
【问题描述】:
弹性搜索:6.3
我正在尝试通过过滤特定的书来更新嵌套字段。以下是样本记录。
{
"StoreName":"test",
"StoreID":"12435",
"BookInfo":[
{
"Name":"Book1",
"Comments":[
{
"date":"2019-01-07",
"Comment":"this is a nice book"
},
{
"date":"2019-01-06",
"Comment":"this is a nice book"
},
{
"date":"2019-01-04",
"Comment":"this is a nice book"
},
{
"date":"2019-01-03",
"Comment":"this is a nice book"
}
],
"UPC":2435466,
},
{
"Name":"Book2",
"Comments":[
{
"date":"2019-01-07",
"Comment":"this is a nice book"
},
{
"date":"2019-01-06",
"Comment":"this is a nice book"
},
{
"date":"2019-01-04",
"Comment":"this is a nice book"
},
{
"date":"2019-01-03",
"Comment":"this is a nice book"
}
],
"UPC":576868345657,
},
}
]
}
在这里,我们有多家商店,每家商店都有多本书。对于每本书,我们每天都存储用户 cmets。我想通过检查该特定日期的评论是否已经存在来在 [BookInfo.Comments] 下添加日期和评论。如果它已经存在,那么我需要跳过它,如果没有,然后附加新的评论。 我尝试通过更新 API 来做到这一点,但我无法过滤特定书籍并从可用书籍列表中更新它的 cmets。有人可以帮我弄这个吗?提前致谢。
【问题讨论】:
标签: elasticsearch nested kibana elasticsearch-painless