以下是我正在使用的代码:
"_source" : {
"name" : "hn name",
"user_id" : 553,
"email_id" : "ns@gmail.com",
"lres_id" : "",
"hres_id" : "hn image",
"followers" : 0,
"following" : 1,
"mentors" : 2,
"mentees" : 2,
"basic_info" : "hn developer",
"birth_date" : 1448451985397,
"charge_price" : 3000,
"org" : "mnc pvt ltd",
"located_in" : "Noidasec51 ",
"position" : "jjunior ava developer",
"requests" : 0,
"exp" : 5,
"video_bio_lres" : "hn test lres url",
"video_bio_hres" : "hn hres url",
"ratings" : [ {
"rating" : 1,
"ratedByUserId" : 777
}, {
"rating" : 1,
"ratedByUserId" : 555
} ],
"avg_rating" : 0.0,
"status" : 0,
"expertises" : [ 3345, 1234, 2345 ],
"blocked_users" : [ ]
}
在以下代码中,我只想删除ratingByUserId 555的评级。但有些我无法这样做。 怎么做?
答案 0 :(得分:0)
它的作品对我来说: -
curl -XPOST'localhost:9200 / mentorz / users / 555 / _update'-d
'{“script”:“ctx._source.ratings.remove(ratings)”,
“PARAMS”:{
“收视率”:{
“等级”:1,
“ratedByUserId”:555个
}
}
}“