Bug in Highlighting


(resetdel) #1

Hi

I'm use latest version of ES(0.15) and had some problems with
highlighting.
Data :
{
...
streamType: Feed
message: bla bla bla post bla bla 1 bla
tenantId: 1
...
}

Example of query:
query : { bool : {must : [
{field: {streamType: {query: "Feed"}}},
{wildcard : { message : "post" }}, {term : { tenantId :
"1" }}, {range : {postDate : {...}}} ]}},
highlight : {"
"pre_tags" : ...
"post_tags" : ...
"fields" : {"message" : {"fragment_size" : 200,
"number_of_fragments" : 1}" } }

Result:
bla bla bla post bla bla <Highlighting

1 bla

As you can see in highlight fields only "message" marked as
highlighted, but in results some items highlighted for field tenantId.

Any ideas how to resolve this?

Thanks.


(Clinton Gormley) #2

Hi

I'm use latest version of ES(0.15) and had some problems with
highlighting.

Please could you gist a curl recreation of the problem - it's easier
than reading it in an email.

See http://www.elasticsearch.com/help for an explanation

thanks

clint


(resetdel) #3

sample https://gist.github.com/837120

On Feb 21, 3:41 pm, Clinton Gormley clin...@iannounce.co.uk wrote:

Hi

I'm use latest version of ES(0.15) and had some problems with
highlighting.

Please could you gist a curl recreation of the problem - it's easier
than reading it in an email.

Seehttp://www.elasticsearch.com/helpfor an explanation

thanks

clint


(resetdel) #4

here: https://gist.github.com/837120

On Feb 21, 3:41 pm, Clinton Gormley clin...@iannounce.co.uk wrote:

Hi

I'm use latest version of ES(0.15) and had some problems with
highlighting.

Please could you gist a curl recreation of the problem - it's easier
than reading it in an email.

Seehttp://www.elasticsearch.com/helpfor an explanation

thanks

clint


(Clinton Gormley) #5

On Mon, 2011-02-21 at 06:37 -0800, resetdel wrote:

here: https://gist.github.com/837120

I haven't used highlighting before, so I'm not sure if this is a bug or
not.

It looks to me like the '1' is being highlighted because you specify
{tenantId: 1} as part of the query, when actually you want it to be
applied as a filter.

I've posted a version using a query of type 'filtered' which highlights
correctly: https://gist.github.com/837120#comments

clint


(Clinton Gormley) #6

Hi resetdel

It looks to me like the '1' is being highlighted because you specify
{tenantId: 1} as part of the query, when actually you want it to be
applied as a filter.

 Yes i'm think so(because tenantId part of query).

 I am not sure that filter will be good for me, because there
 can be more than 100 000 hits (even more than 1000 000 hits),
 and apply filter to this operation will be less productive than
 query.

On the contrary, you definitely want to use filters - they are faster
than queries because ES doesn't have to calculate the scores.

Filters are very fast indeed

clint


(resetdel) #7

A lot of thanks

On Feb 21, 5:32 pm, Clinton Gormley clin...@iannounce.co.uk wrote:

Hi resetdel

It looks to me like the '1' is being highlighted because you specify
{tenantId: 1} as part of the query, when actually you want it to be
applied as a filter.
Yes i'm think so(because tenantId part of query).

 I am not sure that filter will be good for me, because there
 can be more than 100 000 hits (even more than 1000 000 hits),
 and apply filter to this operation will be less productive than
 query.

On the contrary, you definitely want to use filters - they are faster
than queries because ES doesn't have to calculate the scores.

Filters are very fast indeed

clint


(system) #8