has_child get child IDs

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

has_child get child IDs

George Karpenkov
Hi All, 

Is there any particular reason why has_child filter does not return children IDs, possibly behind an option? I mean, surely it must find those in order to return a matching parent...
I saw this github issue - https://github.com/elasticsearch/elasticsearch/issues/2744 - where (apparently?) it used  to return children ids and then stopped.

I'm currently looking into patching my ES installation in order to return children IDs (yes, I can get them by individually asking for all children of all returned parent documents and then querying those, but it turns one query (returning a batch of, say, 20) into 21 queries.

Regards,
George

--
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 [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Reply | Threaded
Open this post in threaded view
|

Re: has_child get child IDs

q42jaap

Hi George,

The issue you referred to is actually saying that child ids shouldn't be collected. It makes sense for has_child to remember only the _parent field. It only needs those to filter the parent query.

If you really want to know the child IDs , you might be able to use a scoped facet.
You might run in to OOM exceptions if you have a lot of child IDs.

Jaap

On May 3, 2013 4:33 AM, "George Karpenkov" <[hidden email]> wrote:
Hi All, 

Is there any particular reason why has_child filter does not return children IDs, possibly behind an option? I mean, surely it must find those in order to return a matching parent...
I saw this github issue - https://github.com/elasticsearch/elasticsearch/issues/2744 - where (apparently?) it used  to return children ids and then stopped.

I'm currently looking into patching my ES installation in order to return children IDs (yes, I can get them by individually asking for all children of all returned parent documents and then querying those, but it turns one query (returning a batch of, say, 20) into 21 queries.

Regards,
George

--
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 [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
 
 

--
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 [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Reply | Threaded
Open this post in threaded view
|

Re: has_child get child IDs

phill
In reply to this post by George Karpenkov
On 5/2/2013 7:32 PM, George Karpenkov wrote:
> I'm currently looking into patching my ES installation in order to
> return children IDs (yes, I can get them by individually asking for
> all children of all returned parent documents and then querying those,
> but it turns one query (returning a batch of, say, 20) into 21 queries.
Why can't combine the results of the 1st query (returning 1) to generate
1 larger 2nd query (returning 20)?

-Paul

--
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 [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.


Reply | Threaded
Open this post in threaded view
|

Re: has_child get child IDs

George Karpenkov-2
Hi All,

@Japp:
1) I'm new in the search field, but to be honest that behaviour does not make sense to me. 
I've referred to the issue because to me it seemed like after the patch ES stopped returning (potentially needed) information, without any flag to ask for it.
I'll try to explain myself: ES has to know that parent P has the child C. Therefore, it has to find a child C first. Therefore, it should know the child ID at the time of query (with cold cache, but child ID could be cached as well).
So to me it seems like it throws away the information which is potentially needed by the callee even though it has it.
Please correct me if I'm wrong.

2) Could you please elaborate on the scoped facet approach? I've seen the passing mention in the documentation, but could not figure out how to use it to solve my problem.

@Paul:
I've tried doing that, yet I haven't found the way.
Suppose ES gives me 10 ids. I can query ES to return me all documents which have those parent ID: just do an analogue of "WHERE parent_id IN (...) LIMIT 10" query.
Yet that does not guarantee to give me one child per each parent document --- it could give me 10 child documents for the first parent I have. 
Is there a better way?

Regards,
George



On Tue, May 7, 2013 at 2:44 AM, Paul Hill <[hidden email]> wrote:
On 5/2/2013 7:32 PM, George Karpenkov wrote:
I'm currently looking into patching my ES installation in order to return children IDs (yes, I can get them by individually asking for all children of all returned parent documents and then querying those, but it turns one query (returning a batch of, say, 20) into 21 queries.
Why can't combine the results of the 1st query (returning 1) to generate 1 larger 2nd query (returning 20)?

-Paul


--
You received this message because you are subscribed to a topic in the Google Groups "elasticsearch" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/elasticsearch/JQXVrhzVmV8/unsubscribe?hl=en-US.
To unsubscribe from this group and all its topics, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.



--
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 [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.