Retrieve children docs only


(avasilenko) #1

Hello,

Duplicating post from nabble, as it didn't dupicate it here.
I have 1 index object with 2 types: entity and shop</
i>. Object shop is child of object entity and has following mapping.
Sending this query to
object/_search returns me the child doc only, which is ok, as I can
manually join it.
But, when I add term for parent doc, I receive parent doc only as a
search hit. Query example</
a>.

Since according to the docs there is no way to perform parent and
child join, can I at least fetch child docs with search conditions
specified for both parent and child?

Regards,
Alex


(Shay Banon) #2

Not sure I fully understand, but, when you execute a has_child query, you
get back only the parent docs.

On Wed, Aug 17, 2011 at 2:55 PM, Alex Vasilenko aa.vasilenko@gmail.comwrote:

Hello,

Duplicating post from nabble, as it didn't dupicate it here.
I have 1 index object with 2 types: entity and shop</
i>. Object shop is child of object entity and has following mapping.
Sending this query to
object/_search returns me the child doc only, which is ok, as I can
manually join it.
But, when I add term for parent doc, I receive parent doc only as a
search hit. Query example</
a>.

Since according to the docs there is no way to perform parent and
child join, can I at least fetch child docs with search conditions
specified for both parent and child?

Regards,
Alex


(avasilenko) #3

In general the question is:
How can I search both in parent and child docs and retrieve child docs?

2011/8/18 Shay Banon kimchy@gmail.com

Not sure I fully understand, but, when you execute a has_child query, you
get back only the parent docs.

On Wed, Aug 17, 2011 at 2:55 PM, Alex Vasilenko aa.vasilenko@gmail.comwrote:

Hello,

Duplicating post from nabble, as it didn't dupicate it here.
I have 1 index object with 2 types: entity and shop</
i>. Object shop is child of object entity and has following mapping.
Sending this query to
object/_search returns me the child doc only, which is ok, as I can
manually join it.
But, when I add term for parent doc, I receive parent doc only as a
search hit. Query example</
a>.

Since according to the docs there is no way to perform parent and
child join, can I at least fetch child docs with search conditions
specified for both parent and child?

Regards,
Alex


(Shay Banon) #4

You can search child docs since they are just docs, and then retried them.
But that means you can only search on data associated with the child docs.
If you also want to search on parent data, then you will only get back
parent docs. You can go and get child docs associated with parent docs, that
that won't "filter" out possibly matching child docs.

On Thu, Aug 18, 2011 at 3:33 PM, Alex Vasilenko aa.vasilenko@gmail.comwrote:

In general the question is:
How can I search both in parent and child docs and retrieve child docs?

2011/8/18 Shay Banon kimchy@gmail.com

Not sure I fully understand, but, when you execute a has_child query, you
get back only the parent docs.

On Wed, Aug 17, 2011 at 2:55 PM, Alex Vasilenko aa.vasilenko@gmail.comwrote:

Hello,

Duplicating post from nabble, as it didn't dupicate it here.
I have 1 index object with 2 types: entity and shop</
i>. Object shop is child of object entity and has following mapping.
Sending this query to
object/_search returns me the child doc only, which is ok, as I can
manually join it.
But, when I add term for parent doc, I receive parent doc only as a
search hit. Query example</
a>.

Since according to the docs there is no way to perform parent and
child join, can I at least fetch child docs with search conditions
specified for both parent and child?

Regards,
Alex


(avasilenko) #5

So it can be done in 2 queries:
1st one - both on parent and child, retrieving parent only
2nd one - in order to retrieve childs, associated with parent. What query to
use? Filter terms on _parent field, listing all found ids?

2011/8/19 Shay Banon kimchy@gmail.com

You can search child docs since they are just docs, and then retried them.
But that means you can only search on data associated with the child docs.
If you also want to search on parent data, then you will only get back
parent docs. You can go and get child docs associated with parent docs, that
that won't "filter" out possibly matching child docs.

On Thu, Aug 18, 2011 at 3:33 PM, Alex Vasilenko aa.vasilenko@gmail.comwrote:

In general the question is:
How can I search both in parent and child docs and retrieve child docs?

2011/8/18 Shay Banon kimchy@gmail.com

Not sure I fully understand, but, when you execute a has_child query, you
get back only the parent docs.

On Wed, Aug 17, 2011 at 2:55 PM, Alex Vasilenko aa.vasilenko@gmail.comwrote:

Hello,

Duplicating post from nabble, as it didn't dupicate it here.
I have 1 index object with 2 types: entity and shop</
i>. Object shop is child of object entity and has following mapping.
Sending this query to
object/_search returns me the child doc only, which is ok, as I can
manually join it.
But, when I add term for parent doc, I receive parent doc only as a
search hit. Query example</
a>.

Since according to the docs there is no way to perform parent and
child join, can I at least fetch child docs with search conditions
specified for both parent and child?

Regards,
Alex


(system) #6