# No highlights with custom score query

**URL:** <https://discuss.elastic.co/t/no-highlights-with-custom-score-query/6090>\
**Category:** Elasticsearch\
**Created:** [December 7, 2011, 4:55pm UTC](https://discuss.elastic.co/t/no-highlights-with-custom-score-query/6090 "2011-12-07T16:55:09Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![awopython](https://avatars.discourse-cdn.com/v4/letter/a/f6c823/32.png) [@awopython](https://discuss.elastic.co/u/awopython)\
**Post date:** [December 7, 2011, 4:55pm UTC](https://discuss.elastic.co/t/no-highlights-with-custom-score-query/6090/1 "2011-12-07T16:55:09Z")

</div>

Here is my query:

/opt/local/btop\_bundle$ curl -XGET '[http://localhost:9200/ecp/\_search](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!

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [December 9, 2011, 10:19pm UTC](https://discuss.elastic.co/t/no-highlights-with-custom-score-query/6090/2 "2011-12-09T22:19:26Z")

</div>

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](mailto:aoliver865@gmail.com) wrote:

> Here is my query:
> 
> /opt/local/btop\_bundle$ curl -XGET '[http://localhost:9200/ecp/\_search](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!

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 3:45am UTC](https://discuss.elastic.co/t/no-highlights-with-custom-score-query/6090/3 "2017-07-06T03:45:51Z")

</div>


