Delete Child Documents using parent Id in Parent Child


(Abhijit Shivathare) #1

I have created the parent child mapping for vpost and vplike
Added data as follows
POST /ab/vpost/_bulk
{"index":{"_id": 1}} {"title":"Olympic post 1","uId":"101","uName":"suyog"]}
{"index":{"_id": 2}} {"title":"rio2016 post 1","uId":"101","uName":"suyog"}
POST /ab/vplike/_bulk
{"index":{"_id": 102, "parent": 1}} {"uId":"102","uName":"prasad"}
{"index":{"_id": 103, "parent": 1}} {"uId":"103","uName":"abhijit"}
{"index":{"_id": 101, "parent": 2}} {"uId":"101","uName":"suyog"}
{"index":{"_id": 103, "parent": 2}} {"uId":"103","uName":"abhijit"}
{"index":{"_id": 102, "parent": 2}} {"uId":"102","uName":"prasad"}

I have parent Id of "vpost" and want to delete the all "vplike" for parent.
What will be the best approach? Please suggest. Thanks in advance.


(Yannick Welsch) #2

Delete by query where you use the "has parent" query.


(system) #3