2017-09-14 69 views
0

下面是我使用的代码:在源模型取下模型的列表中选择模型elasticSearch

"_source" : { 
    "name" : "hn name", 
    "user_id" : 553, 
    "email_id" : "[email protected]", 
    "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" : [ ] 
    } 

在下面的代码,我想删除的评价ratedByUserId 555而已。不过有些我如何,我无法为此。 如何做到这一点?

+0

我ts working ... curl -XPOST'http:// localhost:9200/mentorz/users/555/_update'-d'{“script”:“ctx._source.ratings.remove(ratings)”,“params”: { “收视率”:{ “等级”:1, “ratedByUserId”:555}}}'; – User1703

回答

0

其作品对我来说: -
卷曲-XPOST的 'localhost:9200/mentorz /用户/ 555/_Update' -d
“{ “脚本 ”:“ ctx._source.ratings.remove(评级)” ,
“PARAMS”:{
“收视率”:{ “评级”:1,
“ratedByUserId”:555
}
}
}”