Hi Ishan,
I usually do that using a query like this:
{
"query" : {
"constant_score" : {
"filter" : {
"not" : {
"filter" : {
"has_parent" : {
"query" : {
"match_all" : { }
},
"parent_type" : "### PARENT TYPE ###"
}
}
}
}
}
}
}
Good luck! Better test the query before deleting! ;)
Best regards,
Hannes
On 23.05.2014 13:03, Ishan Durugkar wrote:
> Hi,
>
> I am new to elasticsearch. I was trying to create a parent-child mapping
> where the children would be frequently added and removed.
> Every Parent should have at least one child.
>
> What I want to do is, if a child is deleted, I want to check if the parent
> has other children documents, and if not, delete that parent document.
> How do I do this?
>
> I was trying a delete by query, but I am not sure which query I should send.
>
> Thanks for the help! :)
>
--
You received this message because you are subscribed to the Google Groups
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/538080FE.70603%40hkorte.com.
For more options, visit https://groups.google.com/d/optout.