No highlights with custom score query


(awopython) #1

Here is my query:

/opt/local/btop_bundle$ curl -XGET 'http://localhost:9200/ecp/_search'
-d '
{
"highlight": {
"pre_tags": [""],
"fragment_size": 250,
"number_of_fragments": 1,
"fields": {"content": {}, "tease": {}},
"post_tags": [""]
},
"query":
{
"custom_score": {
"lang": "mvel",
"query": {
"query_string": {"query": "steak"}
},
"script": "_score*(doc.pub_date.longValue)"
}
},
"facets": {
"sites": {
"terms": {"field": "sites", "size": 10}
}
},
"fields": ["title", "tease", "pub_date", "django_ct", "django_id",
"type"]
}'

i was expecting to receive highlights with my results, however,
custom_score seems to disallow highlights in resutls. When i take
custom_score out, i get highlights in the result. What am i doing
wrong?

thanks for your help!


(Shay Banon) #2

Which version of elasticsearch are you using? Are you highlighting on a
field with term vectors enabled or not? This has been fixed for non term
vector mapped field based highlighting in recent 0.18 version.

On Wed, Dec 7, 2011 at 6:55 PM, awopython aoliver865@gmail.com wrote:

Here is my query:

/opt/local/btop_bundle$ curl -XGET 'http://localhost:9200/ecp/_search'
-d '
{
"highlight": {
"pre_tags": [""],
"fragment_size": 250,
"number_of_fragments": 1,
"fields": {"content": {}, "tease": {}},
"post_tags": [""]
},
"query":
{
"custom_score": {
"lang": "mvel",
"query": {
"query_string": {"query": "steak"}
},
"script": "_score*(doc.pub_date.longValue)"
}
},
"facets": {
"sites": {
"terms": {"field": "sites", "size": 10}
}
},
"fields": ["title", "tease", "pub_date", "django_ct", "django_id",
"type"]
}'

i was expecting to receive highlights with my results, however,
custom_score seems to disallow highlights in resutls. When i take
custom_score out, i get highlights in the result. What am i doing
wrong?

thanks for your help!


(system) #3