No highlighting of exact mach terms in analyzed field


(Maya) #1

Hello All,

We perform exact match query on _all field and highlight an analyzed field
(text.
), which contains the text:
{
"query" : {
"bool" : {
"must" : [ {
"bool" : {
"must" : [ {
"query_string" : {
"query" : ""published in 1937"",
"fields" : [ "_all" ],
"default_operator" : "and",
"boost" : 10.0
}
} ]
}
} ]
}
},
"filter" : {
"and" : {
"filters" : [ {
"and" : {
"filters" : [ {
"fquery" : {
"query" : {
"query_string" : {
"query" : ""58468762-fddc-44ea-af4a-270d00000080"",
"fields" : [ "_id" ]
}
},
"_cache" : true
}
} ]
}
} ]
}
},
"fields" : [ "_source", "_score" ],
"track_scores" : true,
"highlight" : {
"fields" : {
"text.
" : {
"fragment_size" : 50000,
"number_of_fragments" : 1000
}
}
}
}

We receive a document for result, but it has no highlighting. Sometimes
there is partial highlighting: for example if we search for "we live in NY"
the highlight is: live in NY</em and not the full match.

Can you please explain what do we do wrong?

Many Thanks.

Maya

--
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 elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/f3458c8e-7937-460d-a610-59ad8b449a37%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(Adrien Grand) #2

Hi,

I'm not sure why you don't get highlights for this particular query, but
regarding the "we live in NY" example, I would guess that you are either
using the default analyzer or an analyzer that has stop words configured,
and this causes very common words such as "we" or "in" to be ignored when
highlighting. Here is an example that would highlight "we" and "in":

On Sun, Dec 15, 2013 at 4:26 PM, mayap maya.pollack@gmail.com wrote:

Hello All,

We perform exact match query on _all field and highlight an analyzed field
(text.
), which contains the text:
{
"query" : {
"bool" : {
"must" : [ {
"bool" : {
"must" : [ {
"query_string" : {
"query" : ""published in 1937"",
"fields" : [ "_all" ],
"default_operator" : "and",
"boost" : 10.0
}
} ]
}
} ]
}
},
"filter" : {
"and" : {
"filters" : [ {
"and" : {
"filters" : [ {
"fquery" : {
"query" : {
"query_string" : {
"query" : ""58468762-fddc-44ea-af4a-270d00000080"",
"fields" : [ "_id" ]
}
},
"_cache" : true
}
} ]
}
} ]
}
},
"fields" : [ "_source", "_score" ],
"track_scores" : true,
"highlight" : {
"fields" : {
"text.
" : {
"fragment_size" : 50000,
"number_of_fragments" : 1000
}
}
}
}

We receive a document for result, but it has no highlighting. Sometimes
there is partial highlighting: for example if we search for "we live in NY"
the highlight is: live in NY</em and not the full match.

Can you please explain what do we do wrong?

Many Thanks.

Maya

--
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 elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/f3458c8e-7937-460d-a610-59ad8b449a37%40googlegroups.com
.
For more options, visit https://groups.google.com/groups/opt_out.

--
Adrien Grand

--
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 elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CAL6Z4j4QPOyDty3fa%3Dh-jHXNv%3Dxezr_HquJywWc5Sb-%2BszD3uw%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


(Maya) #3

Thanks!

On Monday, December 16, 2013 12:25:16 PM UTC+2, Adrien Grand wrote:

Hi,

I'm not sure why you don't get highlights for this particular query, but
regarding the "we live in NY" example, I would guess that you are either
using the default analyzer or an analyzer that has stop words configured,
and this causes very common words such as "we" or "in" to be ignored when
highlighting. Here is an example that would highlight "we" and "in":
https://gist.github.com/jpountz/7984942

On Sun, Dec 15, 2013 at 4:26 PM, mayap <maya.p...@gmail.com <javascript:>>wrote:

Hello All,

We perform exact match query on _all field and highlight an analyzed field
(text.
), which contains the text:
{
"query" : {
"bool" : {
"must" : [ {
"bool" : {
"must" : [ {
"query_string" : {
"query" : ""published in 1937"",
"fields" : [ "_all" ],
"default_operator" : "and",
"boost" : 10.0
}
} ]
}
} ]
}
},
"filter" : {
"and" : {
"filters" : [ {
"and" : {
"filters" : [ {
"fquery" : {
"query" : {
"query_string" : {
"query" : ""58468762-fddc-44ea-af4a-270d00000080"",
"fields" : [ "_id" ]
}
},
"_cache" : true
}
} ]
}
} ]
}
},
"fields" : [ "_source", "_score" ],
"track_scores" : true,
"highlight" : {
"fields" : {
"text.
" : {
"fragment_size" : 50000,
"number_of_fragments" : 1000
}
}
}
}

We receive a document for result, but it has no highlighting. Sometimes
there is partial highlighting: for example if we search for "we live in NY"
the highlight is: live in NY</em and not the full match.

Can you please explain what do we do wrong?

Many Thanks.

Maya

--
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 elasticsearc...@googlegroups.com <javascript:>.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/f3458c8e-7937-460d-a610-59ad8b449a37%40googlegroups.com
.
For more options, visit https://groups.google.com/groups/opt_out.

--
Adrien Grand

--
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 elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/6d15eabc-6d90-442e-9111-e9dc4742f00e%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(system) #4