Support the `has_child`, `has_parent`, `top_children` queries (and filters) in other apis than just search api.

Relates to #3822