Restricting child result


(khoan) #1

index:

{
parent_field: "this is a parent",
children: [
{child_field: 12.3},
{child_field: 9.6},
{child_field: 4.5}
]
}

Now when I search children.child_field: [1.3 TO 4.6], I would get the whole document including all children. Is it possible to just retrieve the document with children which matches search criteria, that is:

expecting:

{
parent_field: "this is a parent",
children: [
{child_field: 4.5}
]
}

instead of:

{
parent_field: "this is a parent",
children: [
{child_field: 12.3},
{child_field: 9.6},
{child_field: 4.5}
]
}

Cheers.


(Ludovic) #2

hi

i have the same trouble. how to show the children filtered ?

tx

On 3 juil, 07:14, khoan huukhoangu...@hotmail.com wrote:

index:

{
parent_field: "this is a parent",
children: [
{child_field: 12.3},
{child_field: 9.6},
{child_field: 4.5}
]

}

Now when I search children.child_field: [1.3 TO 4.6], I would get the whole
document including all children. Is it possible to just retrieve the
document with children which matches search criteria, that is:

expecting:

{
parent_field: "this is a parent",
children: [
{child_field: 4.5}
]

}

instead of:

{
parent_field: "this is a parent",
children: [
{child_field: 12.3},
{child_field: 9.6},
{child_field: 4.5}
]

}

Cheers.

--
View this message in context:http://elasticsearch-users.115913.n3.nabble.com/Restricting-child-res...
Sent from the ElasticSearch Users mailing list archive at Nabble.com.


(Shay Banon) #3

No, there isn't a way to do it unless you index each child document on its own.

On Tuesday, July 5, 2011 at 12:34 PM, Ludovic wrote:

hi

i have the same trouble. how to show the children filtered ?

tx

On 3 juil, 07:14, khoan <huukhoangu...@hotmail.com (http://hotmail.com)> wrote:

index:

{
parent_field: "this is a parent",
children: [
{child_field: 12.3},
{child_field: 9.6},
{child_field: 4.5}
]

}

Now when I search children.child_field: [1.3 TO 4.6], I would get the whole
document including all children. Is it possible to just retrieve the
document with children which matches search criteria, that is:

expecting:

{
parent_field: "this is a parent",
children: [
{child_field: 4.5}
]

}

instead of:

{
parent_field: "this is a parent",
children: [
{child_field: 12.3},
{child_field: 9.6},
{child_field: 4.5}
]

}

Cheers.

--
View this message in context:http://elasticsearch-users.115913.n3.nabble.com/Restricting-child-res...
Sent from the ElasticSearch Users mailing list archive at Nabble.com (http://Nabble.com).


(system) #4