Nested query and highlight fields

I've got my nested query working as intended, but no highlight
fragments are generated on a hit. I assume that this is because each
nested document is indexed separately from the root document, even if
I have include_in_root and include_in_parent set to true. Is there any
way to get highlight fragments to work in nested fields? Thanks!

No, this is not supported currently (and requires some thinking on how to
support it properly...).

On Tue, Jul 26, 2011 at 12:19 AM, Ellery Crane seidaku@gmail.com wrote:

I've got my nested query working as intended, but no highlight
fragments are generated on a hit. I assume that this is because each
nested document is indexed separately from the root document, even if
I have include_in_root and include_in_parent set to true. Is there any
way to get highlight fragments to work in nested fields? Thanks!

As a work around for this issue, I've created my nested query as a
filter with a non-nested version of it as my query. I have all of my
nested fields as include_in_root and include_in_parent, so using the
non-nested version of the query gives me the highlight fragments I'm
after. Unfortunately, this does not restrict the highlights based on
the nested rules, so I need to process them manually in my application
to remove any highlights for nested documents that don't match the
query. This is sub-optimal, but it is working. Couldn't something like
this be done on the ES side of things to generate the highlights for
nested queries?

On Jul 26, 12:56 am, Shay Banon shay.ba...@elasticsearch.com wrote:

No, this is not supported currently (and requires some thinking on how to
support it properly...).

On Tue, Jul 26, 2011 at 12:19 AM, Ellery Crane seid...@gmail.com wrote:

I've got my nested query working as intended, but no highlight
fragments are generated on a hit. I assume that this is because each
nested document is indexed separately from the root document, even if
I have include_in_root and include_in_parent set to true. Is there any
way to get highlight fragments to work in nested fields? Thanks!

As you say, the solution you came up with is problematic. In order to do
highlighting based on the nested query, the nested documents needs to be
extracted as well in order to highlight it, which is more problematic (and
less performant).

On Tue, Jul 26, 2011 at 4:32 PM, Ellery Crane seidaku@gmail.com wrote:

As a work around for this issue, I've created my nested query as a
filter with a non-nested version of it as my query. I have all of my
nested fields as include_in_root and include_in_parent, so using the
non-nested version of the query gives me the highlight fragments I'm
after. Unfortunately, this does not restrict the highlights based on
the nested rules, so I need to process them manually in my application
to remove any highlights for nested documents that don't match the
query. This is sub-optimal, but it is working. Couldn't something like
this be done on the ES side of things to generate the highlights for
nested queries?

On Jul 26, 12:56 am, Shay Banon shay.ba...@elasticsearch.com wrote:

No, this is not supported currently (and requires some thinking on how to
support it properly...).

On Tue, Jul 26, 2011 at 12:19 AM, Ellery Crane seid...@gmail.com
wrote:

I've got my nested query working as intended, but no highlight
fragments are generated on a hit. I assume that this is because each
nested document is indexed separately from the root document, even if
I have include_in_root and include_in_parent set to true. Is there any
way to get highlight fragments to work in nested fields? Thanks!

Is there no way to pass on the highlight fields of the main query to
the nested query? The fields are the same, so presumably they would
need no enhancement? Then you could aggregate the highlight field
results of the nested queries with those of the outer query. Or is
this not at all how the nested queries are being performed? I confess
to be being unaware of the details. The documentation and behavior
I've observed suggests that it's joining the results of individual
searches against the nested documents with that of the root document;
I have no idea how possible passing along highlight fields is in that
context.

On Jul 26, 10:06 am, Shay Banon shay.ba...@elasticsearch.com wrote:

As you say, the solution you came up with is problematic. In order to do
highlighting based on the nested query, the nested documents needs to be
extracted as well in order to highlight it, which is more problematic (and
less performant).

On Tue, Jul 26, 2011 at 4:32 PM, Ellery Crane seid...@gmail.com wrote:

As a work around for this issue, I've created my nested query as a
filter with a non-nested version of it as my query. I have all of my
nested fields as include_in_root and include_in_parent, so using the
non-nested version of the query gives me the highlight fragments I'm
after. Unfortunately, this does not restrict the highlights based on
the nested rules, so I need to process them manually in my application
to remove any highlights for nested documents that don't match the
query. This is sub-optimal, but it is working. Couldn't something like
this be done on the ES side of things to generate the highlights for
nested queries?

On Jul 26, 12:56 am, Shay Banon shay.ba...@elasticsearch.com wrote:

No, this is not supported currently (and requires some thinking on how to
support it properly...).

On Tue, Jul 26, 2011 at 12:19 AM, Ellery Crane seid...@gmail.com
wrote:

I've got my nested query working as intended, but no highlight
fragments are generated on a hit. I assume that this is because each
nested document is indexed separately from the root document, even if
I have include_in_root and include_in_parent set to true. Is there any
way to get highlight fragments to work in nested fields? Thanks!

Thats not how highlighting works...

On Tue, Jul 26, 2011 at 6:26 PM, Ellery Crane seidaku@gmail.com wrote:

Is there no way to pass on the highlight fields of the main query to
the nested query? The fields are the same, so presumably they would
need no enhancement? Then you could aggregate the highlight field
results of the nested queries with those of the outer query. Or is
this not at all how the nested queries are being performed? I confess
to be being unaware of the details. The documentation and behavior
I've observed suggests that it's joining the results of individual
searches against the nested documents with that of the root document;
I have no idea how possible passing along highlight fields is in that
context.

On Jul 26, 10:06 am, Shay Banon shay.ba...@elasticsearch.com wrote:

As you say, the solution you came up with is problematic. In order to do
highlighting based on the nested query, the nested documents needs to be
extracted as well in order to highlight it, which is more problematic
(and
less performant).

On Tue, Jul 26, 2011 at 4:32 PM, Ellery Crane seid...@gmail.com wrote:

As a work around for this issue, I've created my nested query as a
filter with a non-nested version of it as my query. I have all of my
nested fields as include_in_root and include_in_parent, so using the
non-nested version of the query gives me the highlight fragments I'm
after. Unfortunately, this does not restrict the highlights based on
the nested rules, so I need to process them manually in my application
to remove any highlights for nested documents that don't match the
query. This is sub-optimal, but it is working. Couldn't something like
this be done on the ES side of things to generate the highlights for
nested queries?

On Jul 26, 12:56 am, Shay Banon shay.ba...@elasticsearch.com wrote:

No, this is not supported currently (and requires some thinking on
how to
support it properly...).

On Tue, Jul 26, 2011 at 12:19 AM, Ellery Crane seid...@gmail.com
wrote:

I've got my nested query working as intended, but no highlight
fragments are generated on a hit. I assume that this is because
each
nested document is indexed separately from the root document, even
if
I have include_in_root and include_in_parent set to true. Is there
any
way to get highlight fragments to work in nested fields? Thanks!