Hi, I have a problem with the highlighting feature. In my query I use
dis_max, constant_score, bool and query_string together. It works when I
use for example only the terms query or only the query string query. Are
there any restrictions on the use of highlighting?
ES versions: 0.18.1, 0.19.9
{
"sort": [
{
"_score": "desc"
},
{
"name": "asc"
}
],
"from": 0,
"size": 50,
"highlight": {
"fragment_size": 0,
"number_of_fragments": 0,
"fields": {
"names": {},
"content": {}
}
},
"query": {
"dis_max": {
"tie_breaker": 0.0,
"queries": [
{
"constant_score": {
"query": {
"bool": {
"should": [
{
"bool": {
"must": [
{
"query_string": {
"query": "foo AND NOT bar",
"fields": [
"names",
"content"
]
}
},
...
]
}
}
]
}
},
"boost": 20.0
}
},
...
]
}
}
}
--
Problem solved. I declare the following in the mapping for the fields I
want to highlight:
:term_vector => "with_positions_offsets", :store => "yes"
This enables the fast vector highlighter.
On Monday, September 10, 2012 4:13:04 PM UTC+2, Robert Moszczynski wrote:
Hi, I have a problem with the highlighting feature. In my query I use
dis_max, constant_score, bool and query_string together. It works when I
use for example only the terms query or only the query string query. Are
there any restrictions on the use of highlighting?
ES versions: 0.18.1, 0.19.9
{
"sort": [
{
"_score": "desc"
},
{
"name": "asc"
}
],
"from": 0,
"size": 50,
"highlight": {
"fragment_size": 0,
"number_of_fragments": 0,
"fields": {
"names": {},
"content": {}
}
},
"query": {
"dis_max": {
"tie_breaker": 0.0,
"queries": [
{
"constant_score": {
"query": {
"bool": {
"should": [
{
"bool": {
"must": [
{
"query_string": {
"query": "foo AND NOT bar",
"fields": [
"names",
"content"
]
}
},
...
]
}
}
]
}
},
"boost": 20.0
}
},
...
]
}
}
}
--