2017-09-14 35 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
}
}
}」